peteboere / css-crush

CSS preprocessor.
http://the-echoplex.net/csscrush
MIT License
537 stars 51 forks source link

Missing bcdiv() function #21

Closed lencioni closed 12 years ago

lencioni commented 12 years ago

When I try to use the percent function like this:

property: percent( 200, 960 );

I see the following fatal error:

Fatal error: Call to undefined function bcdiv() in /path/to/css-crush/lib/Function.php on line 255

I'm guessing it is because we don't have the BCMath extension enabled. What do you think of possibly adding this function if it is missing (as suggested in this comment)?

if( !function_exists( "bcdiv" ) )
{
    function bcdiv( $first, $second, $scale = 0 )
    {
        $res = $first / $second;
        return round( $res, $scale );
    }
}
peteboere commented 12 years ago

Fix coming soon to the test branch for when bcmath is not available.

In the meantime you can create percentages like: property: ( 200 / 960 * 100 )%

peteboere commented 12 years ago

Fix in the master branch now (v.1.4.1)