Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Better way to handle with default sourceMaps
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Nov 22, 2015
1 parent 2a90e9f commit b8b3487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/View/Helper/LessHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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'] = [];
}
Expand Down
7 changes: 4 additions & 3 deletions tests/TestCase/View/Helper/LessHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -94,7 +94,8 @@ public function testJsBlock()
public function testCompile()
{
$options = [
'compress' => true
'compress' => true,
'sourceMap' => false
];

// Basic compiling
Expand Down

0 comments on commit b8b3487

Please sign in to comment.