mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Fix #2085 SCSS compile error when variables contain false, null, empty string, etc.
This commit is contained in:
parent
875e5d1c2c
commit
969ee5d068
1 changed files with 13 additions and 1 deletions
|
|
@ -238,7 +238,19 @@ class Formatter
|
|||
$scss_compiler->setImportPaths(array(dirname(is_array($source_filename) ? array_first($source_filename) : $source_filename)));
|
||||
if ($variables)
|
||||
{
|
||||
$scss_compiler->addVariables(array_map('\ScssPhp\ScssPhp\ValueConverter::parseValue', $variables));
|
||||
$converted_variables = [];
|
||||
foreach ($variables as $key => $val)
|
||||
{
|
||||
if (is_string($val) && $val !== '')
|
||||
{
|
||||
$converted_variables[$key] = \ScssPhp\ScssPhp\ValueConverter::parseValue($val);
|
||||
}
|
||||
else
|
||||
{
|
||||
$converted_variables[$key] = \ScssPhp\ScssPhp\ValueConverter::fromPhp($val);
|
||||
}
|
||||
}
|
||||
$scss_compiler->addVariables($converted_variables);
|
||||
}
|
||||
|
||||
$content = $scss_compiler->compileString($content)->getCss() . "\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue