The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Libsass Math Plugin

Native libsass plugin adding trigonometric and mathematical functions.

Building

You need to have libsass already compiled or installed as a shared library (inclusive header files). It is then compiled via cmake. See this example to compile it on windows via MinGW Compiler Suite:

cmd git clone https://github.com/sass/libsass.git mingw32-make -C libsass BUILD=shared CC=gcc -j5 git clone https://github.com/mgreter/libsass-math.git cd libsass-math && mkdir build && cd build cmake -G "MinGW Makefiles" .. -DLIBSASS_DIR="..\..\libsass" mingw32-make CC=gcc -j5 && dir math.dll

You may define LIBSASS_INCLUDE_DIR and LIBSASS_LIBRARY_DIR separately!

API

The following globals are available when you import the math plugin. - $E - Euler's number (used for the natural logarithm). - $PI - The ratio of a circle's circumference to its diameter. - $TAU - The double of pi, because Pi is wrong.

The following functions are available when you import the math plugin.

math/numeric

math/exponentiation

math/trigonometry

math/hyperbolic

math/inverse-trigonometry

math/inverse-hyperbolic

© 2015 Marcel Greter