Skip to content

Commit

Permalink
refactor: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jan 29, 2025
1 parent 3988298 commit f01f8f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
'compile' => [
'enabled' => true, // enables Sass files compilation
'style' => 'expanded', // compilation style (`expanded` or `compressed`)
'import' => ['sass', 'scss', 'node_modules'], // list of imported paths
'import' => ['sass', 'scss', 'node_modules'], // list of imported directories
'sourcemap' => false, // enables sourcemap in debug mode
//'variables' => ['<name>' => '<value>'], // list of preset variables
],
Expand Down
5 changes: 3 additions & 2 deletions src/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function compile(): self
$cacheKey = $cache->createKeyFromAsset($this, ['compiled']);
if (!$cache->has($cacheKey)) {
$scssPhp = new Compiler();
$scssPhp->setQuietDeps(true);
// import paths
$importDir = [];
$importDir[] = Util::joinPath($this->config->getStaticPath());
$importDir[] = Util::joinPath($this->config->getAssetsPath());
Expand All @@ -272,6 +272,7 @@ public function compile(): self
$importDir[] = Util::joinPath($this->config->getThemeDirPath($theme, "assets/$dir"));
}
}
$scssPhp->setQuietDeps(true);
$scssPhp->setImportPaths(array_unique($importDir));
// source map
if ($this->builder->isDebug() && (bool) $this->config->get('assets.compile.sourcemap')) {
Expand Down Expand Up @@ -307,7 +308,7 @@ public function compile(): self
// debug
if ($this->builder->isDebug()) {
$scssPhp->setQuietDeps(false);
$this->builder->getLogger()->debug(\sprintf("SCSS imported dir:\n%s", (string) print_r($importDir, true)));
$this->builder->getLogger()->debug(\sprintf("SCSS compiler imported paths:\n%s", (string) implode("\n", array_unique($importDir))));
}
// update data
$this->data['path'] = preg_replace('/sass|scss/m', 'css', $this->data['path']);
Expand Down

0 comments on commit f01f8f0

Please sign in to comment.