|
3 | 3 | namespace wcf\system\style; |
4 | 4 |
|
5 | 5 | use ScssPhp\ScssPhp\Compiler; |
| 6 | +use ScssPhp\ScssPhp\Exception\SassException; |
6 | 7 | use ScssPhp\ScssPhp\OutputStyle; |
7 | 8 | use ScssPhp\ScssPhp\ValueConverter; |
8 | 9 | use wcf\data\application\Application; |
@@ -705,20 +706,18 @@ private function prepareFile(string $filename): string |
705 | 706 | private function compileStylesheet(string $scss, array $variables): string |
706 | 707 | { |
707 | 708 | $compiler = $this->makeCompiler(); |
708 | | - $compiler->replaceVariables(\array_map(static function ($value) { |
| 709 | + $compiler->replaceVariables(\array_map(static function ($value) use (&$i) { |
709 | 710 | if ($value === "" || \is_int($value)) { |
710 | 711 | return ValueConverter::fromPhp($value); |
711 | 712 | } |
712 | 713 |
|
713 | | - // The SCSS v2 compiler trips over string values when trying to feed |
714 | | - // them into `parseValue()`. Explicitly treating them as strings |
715 | | - // when they are not numeric fixes this while preserving the ability |
716 | | - // to work with numbers passed as strings. |
717 | | - if (\is_string($value) && !\is_numeric($value)) { |
718 | | - return ValueConverter::fromPhp($value); |
| 714 | + try { |
| 715 | + return ValueConverter::parseValue($value); |
| 716 | + } catch (SassException $e) { |
| 717 | + if (\str_contains($e->getMessage(), 'Sass modules are not implemented yet')) { |
| 718 | + return ValueConverter::fromPhp($value); |
| 719 | + } |
719 | 720 | } |
720 | | - |
721 | | - return ValueConverter::parseValue($value); |
722 | 721 | }, $variables)); |
723 | 722 |
|
724 | 723 | try { |
|
0 commit comments