fixed scss support

This commit is contained in:
Ulf Gebhardt 2016-01-20 02:41:43 +01:00
parent cc16a4fb4b
commit 7eb1e726cf
2 changed files with 4 additions and 4 deletions

View File

@ -10,9 +10,9 @@ class cache_scss {
return sha1($file.';'.filemtime($file)); return sha1($file.';'.filemtime($file));
} }
public static function url($file){ public static function url($file){
if(!\SYSTEM\CACHE\cache_scss::get($file)){ if(!\SYSTEM\CACHE\cache_scss::get($file->SERVERPATH())){
\LIB\lib_scssphp::php(); \LIB\lib_scssphp::php();
\SYSTEM\CACHE\cache_scss::put($file, (new \Leafo\ScssPhp\Compiler())->compile(file_get_contents($file)));} \SYSTEM\CACHE\cache_scss::put($file->SERVERPATH(), (new \Leafo\ScssPhp\Compiler())->compile(file_get_contents($file->SERVERPATH())));}
return './api.php?call=cache&id='.self::CACHE_SCSS.'&ident='.self::ident($file); return './api.php?call=cache&id='.self::CACHE_SCSS.'&ident='.self::ident($file->SERVERPATH());
} }
} }

View File

@ -31,12 +31,12 @@ class State {
$row['css'] = $row['js'] = array(); $row['css'] = $row['js'] = array();
if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'css') && \is_callable($row['php_class'].'::css')){ if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'css') && \is_callable($row['php_class'].'::css')){
$row['css'] = array_merge($row['css'], \call_user_func($row['php_class'].'::css'));} $row['css'] = array_merge($row['css'], \call_user_func($row['php_class'].'::css'));}
$row['css'] = count($row['css']) > 0 ? array(\SYSTEM\CACHE\cache_css::url($row['css'])) : array();
if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'scss') && \is_callable($row['php_class'].'::scss')){ if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'scss') && \is_callable($row['php_class'].'::scss')){
$scss = \call_user_func($row['php_class'].'::scss'); $scss = \call_user_func($row['php_class'].'::scss');
foreach($scss as $s){ foreach($scss as $s){
$row['css'][] = \SYSTEM\CACHE\cache_scss::url($s);} $row['css'][] = \SYSTEM\CACHE\cache_scss::url($s);}
} }
$row['css'] = count($row['css']) > 0 ? array(\SYSTEM\CACHE\cache_css::url($row['css'])) : array();
if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'js') && \is_callable($row['php_class'].'::js')){ if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'js') && \is_callable($row['php_class'].'::js')){
$row['js'] = array_merge($row['js'], \call_user_func($row['php_class'].'::js'));} $row['js'] = array_merge($row['js'], \call_user_func($row['php_class'].'::js'));}
$row['js'] = count($row['js']) > 0 ? array(\SYSTEM\CACHE\cache_js::url($row['js'])) : array(); $row['js'] = count($row['js']) > 0 ? array(\SYSTEM\CACHE\cache_js::url($row['js'])) : array();