diff --git a/inc/common.class.php b/inc/common.class.php index 77e1e0181..2cc28c3d8 100644 --- a/inc/common.class.php +++ b/inc/common.class.php @@ -565,6 +565,20 @@ public static function getCssFilename() : string { if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) { return 'css/styles.scss'; } + $scssFile = Plugin::getPhpDir('formcreator', false) . '/css/styles.scss'; + $compiled_path = Plugin::getPhpDir('formcreator') . "/css_compiled/" . basename($scssFile, '.scss') . ".min.css"; + if (!file_exists($compiled_path)) { + $css = Html::compileScss( + [ + 'file' => $scssFile, + 'nocache' => true, + 'debug' => true, + ] + ); + if (strlen($css) === @file_put_contents($compiled_path, $css)) { + return 'css/styles.scss'; + } + } return 'css_compiled/styles.min.css'; }