/**
  * {@inheritdoc}
  */
 public function process(Chain $chain)
 {
     $asset = $chain->getAsset();
     $callback = function ($path) use($asset) {
         return $this->notationResolver->convertModuleNotationToPath($asset, $path);
     };
     $chain->setContent($this->cssResolver->replaceRelativeUrls($chain->getContent(), $callback));
 }
示例#2
0
 /**
  * Return replacement of an original @import directive
  *
  * @param array $matchedContent
  * @param LocalInterface $asset
  * @param string $contentType
  * @return string
  */
 protected function replace(array $matchedContent, LocalInterface $asset, $contentType)
 {
     $matchedFileId = $this->fixFileExtension($matchedContent['path'], $contentType);
     $this->recordRelatedFile($matchedFileId, $asset);
     $resolvedPath = $this->notationResolver->convertModuleNotationToPath($asset, $matchedFileId);
     $typeString = empty($matchedContent['type']) ? '' : '(' . $matchedContent['type'] . ') ';
     $mediaString = empty($matchedContent['media']) ? '' : ' ' . trim($matchedContent['media']);
     return "@import {$typeString}'{$resolvedPath}'{$mediaString};";
 }