private function _compile_stylesheet($file)
{
PerchUtil::debug('Compiling SASS file: ' . $file, 'notice');
if (!$this->_site_path) {
$login_path_parts = explode('/', PERCH_LOGINPATH);
$path_parts = explode(DIRECTORY_SEPARATOR, PERCH_PATH);
foreach ($login_path_parts as $part) {
if ($part != '') {
array_pop($path_parts);
}
}
$path = implode(DIRECTORY_SEPARATOR, $path_parts);
$this->_site_path = $path;
}
$compiled_name = PerchUtil::file_path(PERCH_RESFILEPATH . '/' . $this->_get_compiled_name($file));
include_once 'SassParser.php';
$syntax = substr($file, -4, 4);
$options = array('style' => 'expanded', 'cache' => FALSE, 'syntax' => $syntax, 'debug' => FALSE, 'callbacks' => array('warn' => 'warn', 'debug' => 'debug'));
// Execute the compiler.
$parser = new SassParser($options);
try {
file_put_contents($compiled_name, $parser->toCss(PerchUtil::file_path($this->_site_path . $file)));
} catch (Exception $e) {
PerchUtil::debug($e->getMessage(), 'error');
}
}