Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systematic LESS rebuild through configuration #14

Merged
merged 3 commits into from
Oct 9, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions lib/Configuration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion lib/Plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Stylesheet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down