Fixes for SCSS compiler

This commit is contained in:
Andy Miller
2023-05-08 18:21:03 -06:00
parent 8fd500d381
commit beef4420ca
5 changed files with 45 additions and 36 deletions

View File

@@ -10,6 +10,7 @@
namespace Grav\Plugin\Admin;
use ScssPhp\ScssPhp\Compiler;
use ScssPhp\ScssPhp\ValueConverter;
class ScssCompiler
{
@@ -31,7 +32,13 @@ class ScssCompiler
public function setVariables(array $variables)
{
$this->compiler()->setVariables($variables);
// $parsed = ValueConverter::fromPhp($variables);
$parsed = [];
foreach ($variables as $key => $value) {
$parsed[$key] = ValueConverter::parseValue($value);
}
$this->compiler()->addVariables($parsed);
return $this;
}
@@ -55,7 +62,7 @@ class ScssCompiler
foreach ($input_paths as $input_file) {
$input .= trim(file_get_contents($input_file)) . "\n\n";
}
$output = $this->compiler()->compile($input);
$output = $this->compiler()->compileString($input)->getCss();
file_put_contents($output_file, $output);
return $this;
}