N°2314 - Markup extensibility: Refactor utils::GetCSSFromSASS() to enable SCSS compilation out of a file

This commit is contained in:
Molkobain
2020-01-24 16:05:01 +01:00
parent 0a63568715
commit 3ae2058f6f
2 changed files with 32 additions and 21 deletions

View File

@@ -109,18 +109,7 @@ class ThemeHandler
// Checking if our compiled css is outdated
if (!file_exists($sThemeCssPath) || (is_writable($sThemeFolderPath) && (@filemtime($sThemeCssPath) < $iStyleLastModified)))
{
$oScss = new Compiler();
$oScss->setFormatter('ScssPhp\\ScssPhp\\Formatter\\Expanded');
// Setting our xml variables
$oScss->setVariables($aThemeParameters['variables']);
// Setting our imports paths
$oScss->setImportPaths($aImportsPaths);
// Temporary disabling max exec time while compiling
$iCurrentMaxExecTime = (int)ini_get('max_execution_time');
set_time_limit(0);
// Compiling our theme
$sTmpThemeCssContent = $oScss->compile($sTmpThemeScssContent);
set_time_limit($iCurrentMaxExecTime);
$sTmpThemeCssContent = utils::CompileCSSFromSASS($sTmpThemeScssContent, $aImportsPaths, $aThemeParameters['variables']);
file_put_contents($sThemeCssPath, $sTmpThemeCssContent);
}
}