protected static function render_file($path) { $css = parent::render_file($path); $css = str_replace('url(/', 'url(' . URL_ROOT . '/', $css); $css = str_replace('url("/', 'url("' . URL_ROOT . '/', $css); return $css; }
protected static function render_file($path) { $cache_path = $path . '-cache.css'; if (!file_exists($cache_path) || filemtime($cache_path) < filemtime($path)) { $out = parent::render_file($path); $less = new lessc(); $less->importDir = dirname($path); //$less->registerFunction('url', array('LessCompiler', 'url')); $css = $less->parse($out); $css = str_replace('url("/', 'url("' . URL_ROOT . '/', $css); file_put_contents($cache_path, $css); } return file_get_contents($cache_path); }
function insert($name) { return ResourceCompiler::insert($name); }