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 Jul 27, 2021
1 parent 5470dde commit d84b949
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 d84b949

Please sign in to comment.