-
Notifications
You must be signed in to change notification settings - Fork 9
fix for ['parser']['cache_dir'] and ['css'] #16
base: master
Are you sure you want to change the base?
Conversation
additional parameter ['css'] allows for passing to $this->Html->css() Corrected processing of ['parser']['cache_dir'] parameter to allow for $this->Html->css() to generate links with the correct path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can fix these things I'll try to add the test to check the behavior of the cache_dir
working as expected.
@@ -147,14 +147,16 @@ public function less($less = 'styles.less', array $options = [], array $modifyVa | |||
} | |||
|
|||
try { | |||
$css = $this->compile($less, $options['cache'], $options['parser'], $modifyVars); | |||
$cache_dir = isset($options['parser']['cache_dir']) ?$options['parser']['cache_dir']:""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad indentation there + missing spaces in concatenation. BTW, this will be better inside a custom function, so we can properly test the cache behavior.
} else { | ||
$options['cache_dir'] = trim($this->cssPath, '/') . $options['cache_dir']; | ||
} | ||
return \Less_Cache::Get($parse, $options, $modifyVars); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are spaces + tabs in many of these lines. Also, the spaces of the if
are not properly set and you should avoid using else if
. Instead use elseif
.
It's also recommendable not to use else
. Better define the variable before as a fallback.
@@ -327,7 +336,10 @@ protected function setOptions(array $options) | |||
if (!isset($options['cache'])) { | |||
$options['cache'] = true; | |||
} | |||
|
|||
if (empty($options['css'])) { | |||
$options['css'] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a tab here too.
additional parameter ['css'] allows for passing to $this->Html->css()
Corrected processing of ['parser']['cache_dir'] parameter to allow for $this->Html->css() to generate links with the correct path.