diff --git a/system/modules/core/config/config.php b/system/modules/core/config/config.php index 78916ea969..5902eb23eb 100644 --- a/system/modules/core/config/config.php +++ b/system/modules/core/config/config.php @@ -471,6 +471,11 @@ 'SLIMBOX' => '1.8' ); +/** + * Register LESS/SCSS import paths + */ + $GLOBALS['TL_SCSSLESS_PATHS'] = array(); + /** * Other global arrays diff --git a/system/modules/core/library/Contao/Combiner.php b/system/modules/core/library/Contao/Combiner.php index ae7bcf6b06..276aae2351 100644 --- a/system/modules/core/library/Contao/Combiner.php +++ b/system/modules/core/library/Contao/Combiner.php @@ -340,6 +340,12 @@ protected function handleScssLess($content, $arrFile) TL_ROOT . '/vendor/contao-components/compass/css' )); + foreach ($GLOBALS['TL_SCSSLESS_PATHS'] as $strScssLessPath) + { + $strImportPath = ltrim($strScssLessPath, '/\\'); + $objCompiler->addImportPath(TL_ROOT . '/' . $strImportPath); + } + $objCompiler->setFormatter((\Config::get('debugMode') ? 'Leafo\ScssPhp\Formatter\Expanded' : 'Leafo\ScssPhp\Formatter\Compressed')); return $this->fixPaths($objCompiler->compile($content), $arrFile); @@ -354,6 +360,12 @@ protected function handleScssLess($content, $arrFile) 'import_dirs' => array(TL_ROOT . '/' . $strPath => $strPath) ); + foreach ($GLOBALS['TL_SCSSLESS_PATHS'] as $strScssLessPath) + { + $strImportPath = ltrim($strScssLessPath, '/\\'); + $arrOptions['import_dirs'][] = array(TL_ROOT . '/' . $strImportPath => $strImportPath); + } + $objParser = new \Less_Parser($arrOptions); $objParser->parse($content);