/** * Process a single stylesheet * * @author oncletom * @since 1.1 * @version 1.3 * @param string $handle * @param $force boolean If set to true, rebuild all stylesheets, without considering they are updated or not * @return WPLessStylesheet */ public function processStylesheet($handle, $force = false) { $force = !!$force ? $force : $this->configuration->alwaysRecompile(); $wp_styles = $this->getStyles(); $stylesheet = new WPLessStylesheet($wp_styles->registered[$handle], $this->compiler->getVariables()); if ($this->configuration->getCompilationStrategy() === 'legacy' && $stylesheet->hasToCompile()) { $this->compiler->saveStylesheet($stylesheet); } elseif ($this->configuration->getCompilationStrategy() !== 'legacy') { $this->compiler->cacheStylesheet($stylesheet, $force); } $wp_styles->registered[$handle]->src = $stylesheet->getTargetUri(); return $stylesheet; }
/** * Process a single stylesheet * * @author oncletom * @since 1.1 * @version 1.3 * @param string $handle * @param $force boolean If set to true, rebuild all stylesheets, without considering they are updated or not * @return WPLessStylesheet */ public function processStylesheet($handle, $force = false) { $wp_styles = $this->getStyles(); $stylesheet = new WPLessStylesheet($wp_styles->registered[$handle], $this->getConfiguration()->getVariables()); if (is_bool($force) && $force || $stylesheet->hasToCompile()) { $compiler = new WPLessCompiler($stylesheet->getSourcePath()); $compiler->registerFunctions($this->getConfiguration()->getFunctions()); $compiler->saveStylesheet($stylesheet); } $wp_styles->registered[$handle]->src = $stylesheet->getTargetUri(); return $stylesheet; }