public function Scssphp::compileValue in SCSS/Less Compiler 8
File
- src/
Plugin/ ScssCompiler/ Scssphp.php, line 27
Class
- Scssphp
- Extends ScssPhp Compiler.
Namespace
Drupal\scss_compiler\Plugin\ScssCompilerCode
public function compileValue($value, $quote = TRUE) {
$original_value = $value;
if ($value[0] === Type::T_FUNCTION) {
$value = $this
->reduce($value);
$args = !empty($value[2]) ? $this
->compileValue($value[2], $quote) : '';
if ($value[1] == 'url' && $args) {
$args = trim($args, '"\'');
if (substr($args, 0, 5) === 'data:') {
return "{$value[1]}(\"{$args}\")";
}
elseif (substr($args, 0, 1) === '@') {
$path = \Drupal::service('scss_compiler')
->replaceTokens($args);
return "{$value[1]}(\"/{$path}\")";
}
else {
return "{$value[1]}(\"{$this->assetsPath}{$args}\")";
}
}
else {
return "{$value[1]}({$args})";
}
}
return parent::compileValue($original_value, $quote);
}