MDL-44597 lessphp: Add sourceMap support in theme designer mode

This commit is contained in:
Andrew Nicols 2014-03-21 11:48:52 +08:00
parent 379924a6a5
commit 5d504395f7

View File

@ -1034,15 +1034,24 @@ class theme_config {
// 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);