public function PhpCssEmbedFilter::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/PhpCssEmbedFilter.php, line 33

Class

PhpCssEmbedFilter
A filter that embed url directly into css

Namespace

Assetic\Filter

Code

public function filterLoad(AssetInterface $asset) {
  $root = $asset
    ->getSourceRoot();
  $path = $asset
    ->getSourcePath();
  $pce = new CssEmbed();
  if ($root && $path) {
    $pce
      ->setRootDir(dirname($root . '/' . $path));
  }
  $asset
    ->setContent($pce
    ->embedString($asset
    ->getContent()));
}