diff --git a/lib/outputlib.php b/lib/outputlib.php index b8cba1aac3153..8adf2171b6523 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -1034,15 +1034,24 @@ protected function get_css_content_from_less($themedesigner) { // Get the LESS file path. $themelessfile = $files['theme'][$lessfile]; - // Instantiate the compiler. - $compiler = new core_lessc(array( + // Setup compiler options. + $options = array( // We need to set the import directory to where $lessfile is. 'import_dirs' => array(dirname($themelessfile) => '/'), // Always disable default caching. 'cache_method' => false, // Disable the relative URLs, we have post_process() to handle that. 'relativeUrls' => false, - )); + ); + + if ($themedesigner) { + // Add the sourceMap inline to ensure that it is atomically generated. + $options['sourceMap'] = true; + $options['sourceRoot'] = 'theme'; + } + + // Instantiate the compiler. + $compiler = new core_lessc($options); try { $compiler->parse_file_content($themelessfile);