Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #14 from oncletom/feature-14

Systematic LESS rebuild through configuration
  • Loading branch information...
commit 5046c4e96bf84fb95fdc30eb2dc0ed00a156a6fd 2 parents dcf621b + d0fc189
@oncletom authored
View
33 lib/Configuration.class.php
@@ -12,20 +12,37 @@ class WPLessConfiguration extends WPPluginToolkitConfiguration
*/
const VERSION = '1.5-dev';
- /**
- * @protected
- * @see http://leafo.net/lessphp/docs/index.html#custom_functions
- */
- protected $functions = array();
+ /**
+ * @protected
+ * @deprecated
+ * @var bool
+ */
+ protected $alwaysRecompile = false;
protected function configure()
{
- $this->configureOptions();
+ $this->configureOptions();
+ }
+
+ protected function configureOptions()
+ {
+ $this->alwaysRecompile((defined('WP_DEBUG') && WP_DEBUG) || (defined('WP_LESS_ALWAYS_RECOMPILE') && WP_LESS_ALWAYS_RECOMPILE));
}
- protected function configureOptions()
+ /**
+ * Set compilation strategy
+ *
+ * @param $bFlag bool
+ * @return bool Actual compilation "strategy"
+ */
+ public function alwaysRecompile($bFlag = null)
{
- //
+ if (!is_null($bFlag))
+ {
+ $this->alwaysRecompile = !!$bFlag;
+ }
+
+ return $this->alwaysRecompile;
}
}
View
2  lib/Plugin.class.php
@@ -130,7 +130,7 @@ public function processStylesheet($handle, $force = false)
$wp_styles = $this->getStyles();
$stylesheet = new WPLessStylesheet($wp_styles->registered[$handle], $this->compiler->getVariables());
- if ((is_bool($force) && $force) || $stylesheet->hasToCompile())
+ if ((is_bool($force) && $force) || $this->configuration->alwaysRecompile() || $stylesheet->hasToCompile())
{
$this->compiler->saveStylesheet($stylesheet);
}
View
4 lib/Stylesheet.class.php
@@ -180,12 +180,12 @@ public function getTargetUri()
*
* @author oncletom
* @since 1.0
- * @version 1.2
+ * @version 1.3
* @return boolean
*/
public function hasToCompile()
{
- return ($this->is_new || (defined('WP_DEBUG') && WP_DEBUG));
+ return $this->is_new;
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.