commit 156d7cd8b95a84d583639de89f18d61aca90ed6c
parent db793d85eabaae25eb0a9748917e18b1e889ffb7
Author: Jan Dankert <develop@jandankert.de>
Date: Mon, 9 Nov 2020 22:21:24 +0100
Fix: The LESS parser must be created for every new loop.
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/modules/cms/ui/action/IndexAction.class.php b/modules/cms/ui/action/IndexAction.class.php
@@ -212,12 +212,6 @@ class IndexAction extends Action
$lessFile = Startup::THEMES_DIR . 'default/style/theme/openrat-theme.less';
$css = '';
- $parser = new Less(array(
- 'sourceMap' => DEVELOPMENT,
- 'indentation' => DEVELOPMENT?"\t":'',
- 'outputSourceFiles' => false,
- 'compress' => PRODUCTION
- ));
foreach ( C::subset('style')->subsets() as $styleId => $styleConfig)
{
@@ -235,6 +229,14 @@ class IndexAction extends Action
foreach ($styleConfig->getConfig() as $styleSetting => $value)
$lessVars['cms-' . strtolower(strtr($styleSetting, '_', '-'))] = $value;
+
+ // we must create a new instance here, because the less parser is buggy when changing vars.
+ $parser = new Less(array(
+ 'sourceMap' => DEVELOPMENT,
+ 'indentation' => DEVELOPMENT?"\t":'',
+ 'outputSourceFiles' => false,
+ 'compress' => PRODUCTION
+ ));
$parser->parseFile($lessFile,basename($lessFile));
$parser->modifyVars($lessVars);
$css .= $parser->getCss();