public function preprocess($file) { //TODO: to options $suffix = '.less'; if (Core_Strings::ends_with($file, $suffix)) { $file = Templates_HTML::css_path($file, false); $css_file = md5($file) . '.css'; $css_file = Templates_HTML_Preprocess::option('less_output_dir') . '/' . $css_file; //TODO: errors $this->compile('./' . $file, $css_file); return '/' . ltrim($css_file, '\\/.'); } return $file; }
public function preprocess($file, $data) { //TODO: to options $suffix = '.less'; $content = null; if (Core_Strings::ends_with($file, $suffix)) { $file = Templates_HTML::css_path($file, false); $file_name = ltrim($file, '/\\.'); $less_file = './' . ltrim($file, '/'); $css_file = str_replace('css.less', 'less.css', $file_name); $css_file = str_replace('styles/', '', $css_file); $css_file = './' . self::option('less_output_dir') . '/' . $css_file; $css_file = str_replace('//', '/', $css_file); $dir = dirname($css_file); if (!IO_FS::exists($dir)) { IO_FS::mkdir($dir); } $this->compile($less_file, $css_file); return array('/' . ltrim($css_file, '\\/.'), $content); } return array($file, $content); }
public function preprocess($file, $data) { $suffix = '.scss'; $content = null; if (Core_Strings::ends_with($file, $suffix)) { $this->load(); if (!$this->server) { return array($file, $content); } // TODO: move to function $file = Templates_HTML::css_path($file, false); $file_name = ltrim($file, '/\\.'); $scss_file = './' . ltrim($file, '/'); $css_file = str_replace('.scss', '.css', $file_name); $css_file = str_replace('styles/', '', $css_file); $css_file = './' . self::option('scss_output_dir') . '/' . $css_file; $css_file = str_replace('//', '/', $css_file); $dir = dirname($css_file); if (!IO_FS::exists($dir)) { IO_FS::mkdir($dir); } if ($this->server->needsCompile($scss_file, $css_file, $etag = '')) { $this->server->compile($scss_file, $css_file); } return array('/' . ltrim($css_file, '\\/.'), $content); } return array($file, $content); }
/** * Проверяет установлен ли редактор * * @return boolean */ public function is_installed() { foreach ($this->include_files() as $file) { $ext = pathinfo($file['name'], PATHINFO_EXTENSION); if ($ext == 'js' && !is_file('.' . Templates_HTML::js_path($file['name']))) { return false; } if ($ext == 'css' && !is_file('.' . Templates_HTML::css_path($file['name']))) { return false; } } return true; }
protected function css_path($path, $add_timestamp = true, $absolute = null) { $path = Templates_HTML::css_path($path); $url = $this->create_asset_url($path, $absolute); return $add_timestamp ? $this->add_timestamp($path, $url) : $path; }