The sass
extension for PHP gives you an object-oriented system of parsing Sass from within your PHP applications. Under the hood it uses libsass to provide super speedy and compatible Sass parsing.
Sass is a CSS pre-processor language to add on exciting, new, awesome features to CSS. Sass was the first language of its kind and by far the most mature and up to date codebase.
Sass was originally created by Hampton Catlin (@hcatlin). The extension and continuing evolution of the language has all been the result of years of work by Nathan Weizenbaum (@nex3) and Chris Eppstein (@chriseppstein).
For more information about Sass itself, please visit http://sass-lang.com
Currently, the only way to install the extension is manually:
$ git clone git://github.com/jamierumbelow/sassphp
Remember to grab your submodules:
$ git submodule init
$ git submodule update
...and compile it! I've written a little PHP script to do all the stuff you need to do:
$ php install.php
Run the tests:
$ make test
Finally, you can install with make
:
$ make install
And then add it to your php.ini:
extension=sass.so
This extension has a very simple API:
$css = Sass::parse($source);
You can parse a file with parse_file()
:
$css = Sass::parse_file('path_to_file.scss');
If there's a problem, the extension will throw a SassException
:
try
{
$css = Sass::parse('dayrui3dui36di37');
}
catch (SassException $e)
{
// $e->getMessage() - ERROR -- , line 1: invalid top-level expression
$css = FALSE;
}
Version 0.1.0 - IN DEVELOPMENT
- Initial release