public function ScssphpFilter::filterLoad

Filters an asset after it has been loaded.

Parameters

AssetInterface $asset An asset:

Overrides FilterInterface::filterLoad

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Filter/ScssphpFilter.php, line 42

Class

ScssphpFilter
Loads SCSS files using the PHP implementation of scss, scssphp.

Namespace

Assetic\Filter

Code

public function filterLoad(AssetInterface $asset) {
  $root = $asset
    ->getSourceRoot();
  $path = $asset
    ->getSourcePath();
  $lc = new \scssc();
  if ($this->compass) {
    new \scss_compass($lc);
  }
  if ($root && $path) {
    $lc
      ->addImportPath(dirname($root . '/' . $path));
  }
  foreach ($this->importPaths as $path) {
    $lc
      ->addImportPath($path);
  }
  $asset
    ->setContent($lc
    ->compile($asset
    ->getContent()));
}