From dd3e1ead4cdbe1aee277a1d72b1233fc94d8ca73 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Tue, 27 Jul 2021 19:40:35 +0200 Subject: [PATCH] add support for compileString() method in scssphp 1.5 and above The SCSS task uses Compiler::compile() which is deprecated in current scssphp. Add support for new compileString() method which returns a result object instead of string. --- src/Task/Assets/Scss.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Task/Assets/Scss.php b/src/Task/Assets/Scss.php index 999604b1a..eb718eab2 100644 --- a/src/Task/Assets/Scss.php +++ b/src/Task/Assets/Scss.php @@ -64,7 +64,12 @@ protected function scssphp($file) $scss->setFormatter($this->compilerOptions['formatter']); } - return $scss->compile($scssCode); + if (method_exists($scss, 'compileString')) { + // "compileString()" is available since scssphp v1.5 + return $scss->compileString($scssCode)->getCss(); + } else { + return $scss->compile($scssCode); + } } /**