/** * @see sfWebDebugPanel */ public function getPanelContent() { $this->compiler = sfSassCompilerDefault::getInstance(sfContext::getInstance()->getEventDispatcher()); $status = $this->compiler->getStatus(); $stdout = $this->compiler->getStdOut(); $cmd = $this->compiler->getCommand(); $content = <<<DEBUG <h2>Command</h2> <p style="display: block; border: 1px solid black; padding: 5px; background-color: white;">{command}</p> <h2>Status</h2> <p style="display: block; border: 1px solid black; padding: 5px; background-color: white;">{status}</p> DEBUG; if (!empty($stdout)) { $content .= <<<STDOUT <h2>Output</h2> <div style="display: block; border: 1px solid black; padding: 5px; background-color: white;"> {stdout} </div> STDOUT; } require_once sfConfig::get('sf_symfony_lib_dir') . '/helper/TextHelper.php'; $content = strtr($content, array('{command}' => htmlentities($cmd), '{stdout}' => simple_format_text(htmlentities($stdout)), '{status}' => $status)); if (!empty($stdout)) { $this->setStatus(preg_match('/error /mi', $stdout) === 1 ? sfLogger::ERR : sfLogger::WARNING); } else { $this->setStatus(sfLogger::INFO); } return $content . "<br/>"; }
/** * Return the instance of the compiler * * @param sfEventDispatcher $dispatcher Event dispatcher * @return sfSassCompiler The instance */ public static function getInstance(sfEventDispatcher $dispatcher) { if (!self::$instance) { self::$instance = new sfSassCompilerDefault($dispatcher); } return self::$instance; }
public function compileSass() { $compiler = sfSassCompilerDefault::getInstance($this->dispatcher); $compiler->compile(sfConfig::get('app_sfSassyCssPlugin_input_dir'), sfConfig::get('app_sfSassyCssPlugin_output_dir'), sfConfig::get('app_sfSassyCssPlugin_cache_dir')); if ($compiler->getStatus() != 0) { $compiler->clean(sfConfig::get('app_sfSassyCssPlugin_input_dir'), sfConfig::get('app_sfSassyCssPlugin_output_dir')); } }