Fix Scss: injetar cores hex como cor SCSS, não string com aspas
ValueConverter::fromPhp('#0b0e1a') gera SassString com aspas, e
'background-color:"#0b0e1a"' é CSS inválido (browser ignora — fundo
cinza). Bug latente desde os temas legados (afetava qualquer uso direto
de $var injetada, ex. cor do botão); ficou visível quando os fundos
passaram a usar $page-background-color. Hex agora entra via parseValue()
como cor de verdade — também habilita funções de cor sobre as variáveis.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
d36e14c767
commit
fade913fa9
1 changed files with 7 additions and 1 deletions
|
|
@ -19,8 +19,14 @@ class Scss {
|
||||||
if (!empty($variables)) {
|
if (!empty($variables)) {
|
||||||
$convertedVariables = [];
|
$convertedVariables = [];
|
||||||
foreach ($variables as $key => $value) {
|
foreach ($variables as $key => $value) {
|
||||||
|
if (is_string($value) && preg_match('/^#[0-9a-fA-F]{3,8}$/', $value)) {
|
||||||
|
// Cores hex precisam entrar como cor SCSS de verdade: fromPhp()
|
||||||
|
// gera string com aspas ("#0b0e1a"), que é CSS inválido
|
||||||
|
$convertedVariables[$key] = \ScssPhp\ScssPhp\ValueConverter::parseValue($value);
|
||||||
|
} else {
|
||||||
$convertedVariables[$key] = \ScssPhp\ScssPhp\ValueConverter::fromPhp($value);
|
$convertedVariables[$key] = \ScssPhp\ScssPhp\ValueConverter::fromPhp($value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$scss->addVariables($convertedVariables);
|
$scss->addVariables($convertedVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue