Skip to content

Commit

Permalink
add support for compileString() method in scssphp 1.5 and above
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stklcode committed Jun 15, 2022
1 parent a5b74eb commit dd3e1ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Task/Assets/Scss.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit dd3e1ea

Please sign in to comment.