diff --git a/src/View/Helper/LessHelper.php b/src/View/Helper/LessHelper.php index 3d8570b..11a2b9a 100644 --- a/src/View/Helper/LessHelper.php +++ b/src/View/Helper/LessHelper.php @@ -235,6 +235,10 @@ public function compile(array $input, array $options = [], array $modify_vars = } } + if (Configure::read('debug') && !isset($options['sourceMap'])) { + $options['sourceMap'] = true; + } + if ($cache) { $options += ['cache_dir' => $this->css_path]; return \Less_Cache::Get($to_parse, $options, $modify_vars); @@ -290,10 +294,6 @@ private function setOptions(array $options) } ]); - if (Configure::read('debug') && !isset($this->parser_defaults['sourceMap'])) { - $this->parser_defaults['sourceMap'] = true; - } - if (empty($options['parser'])) { $options['parser'] = []; } diff --git a/tests/TestCase/View/Helper/LessHelperTest.php b/tests/TestCase/View/Helper/LessHelperTest.php index ab4caba..3f6da06 100644 --- a/tests/TestCase/View/Helper/LessHelperTest.php +++ b/tests/TestCase/View/Helper/LessHelperTest.php @@ -45,7 +45,7 @@ public function testLess() // [Less.php] Compiling using cache (here we only check for the // resulting tag, as the compilation checks are made in testCompile) - $result = $this->Less->less('less/test.less'); + $result = $this->Less->less('less/test.less', ['parser' => ['sourceMap' => false]]); $this->assertHtml([ 'link' => [ 'rel' => 'stylesheet', @@ -54,7 +54,7 @@ public function testLess() ], $result); // Trying the js fallback - $result = $this->Less->less('less/test_error.less'); + $result = $this->Less->less('less/test_error.less', ['parser' => ['sourceMap' => false]]); $this->assertHtml([ 'link' => [ 'rel' => 'stylesheet/less', @@ -94,7 +94,8 @@ public function testJsBlock() public function testCompile() { $options = [ - 'compress' => true + 'compress' => true, + 'sourceMap' => false ]; // Basic compiling