29 lines
622 B
PHP
29 lines
622 B
PHP
<?php
|
|
|
|
namespace sacy;
|
|
|
|
class PhpSassSacy
|
|
{
|
|
public static function isAvailable()
|
|
{
|
|
return extension_loaded('sass')/* && defined('SASS_FLAVOR') && SASS_FLAVOR == 'sensational' */
|
|
;
|
|
}
|
|
|
|
public static function compile($file, $fragment, $load_path)
|
|
{
|
|
$sass = new \Sass();
|
|
|
|
$load_path = array_map(function ($x) {
|
|
return getcwd().$x;
|
|
}, $load_path);
|
|
$sass->setIncludePath(implode(':', $load_path));
|
|
|
|
if ($file) {
|
|
return $sass->compile_file($file);
|
|
} else {
|
|
return $sass->compile($fragment);
|
|
}
|
|
}
|
|
}
|