From 4a6215149ee910eb68bc17172060d55ac019a368 Mon Sep 17 00:00:00 2001 From: Bas Brands Date: Tue, 14 Jan 2020 11:28:55 +0100 Subject: [PATCH 1/1] MDL-67689 theme_boost: improve theme designer mode performance --- lib/outputlib.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index d50d022a9b9..e3a354ebccc 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -1208,6 +1208,7 @@ class theme_config { */ public function get_css_content_debug($type, $subtype, $sheet) { + if ($type === 'scss') { // The SCSS file of the theme is requested. $csscontent = $this->get_css_content_from_scss(true); @@ -1430,9 +1431,17 @@ class theme_config { // TODO: MDL-62757 When changing anything in this method please do not forget to check // if the validate() method in class admin_setting_configthemepreset needs updating too. - + $cacheoptions = ''; + if ($themedesigner) { + $scsscachedir = $CFG->localcachedir . '/scsscache/'; + $cacheoptions = array( + 'cacheDir' => $scsscachedir, + 'prefix' => 'scssphp_', + 'forceRefresh' => false, + ); + } // Set-up the compiler. - $compiler = new core_scss(); + $compiler = new core_scss($cacheoptions); $compiler->prepend_raw_scss($this->get_pre_scss_code()); if (is_string($scss)) { $compiler->set_file($scss); -- 2.43.0