/**
  * {@inheritdoc}
  */
 public function process(Chain $chain)
 {
     $callback = function ($path) {
         return $this->notationResolver->convertVariableNotation($path);
     };
     $chain->setContent($this->cssResolver->replaceRelativeUrls($chain->getContent(), $callback));
 }
 /**
  * {@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));
 }
Exemplo n.º 3
0
 public function testMergeCss()
 {
     $this->resultAsset->expects($this->exactly(3))->method('getPath')->will($this->returnValue('foo/result'));
     $this->resultAsset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
     $assets = $this->prepareAssetsToMerge(['one', 'two']);
     $this->cssUrlResolver->expects($this->exactly(2))->method('relocateRelativeUrls')->will($this->onConsecutiveCalls('1', '2'));
     $this->cssUrlResolver->expects($this->once())->method('aggregateImportDirectives')->with('12')->will($this->returnValue('1020'));
     $this->writeDir->expects($this->once())->method('writeFile')->with('foo/result', '1020');
     $this->object->merge($assets, $this->resultAsset);
 }
Exemplo n.º 4
0
 /**
  * Process the resulting asset after merging content is done
  *
  * @param Asset\LocalInterface $result
  * @param string $content
  * @return string
  */
 private function preProcessMergeResult(Asset\LocalInterface $result, $content)
 {
     if ($result->getContentType() == 'css') {
         $content = $this->cssUrlResolver->aggregateImportDirectives($content);
     }
     return $content;
 }
Exemplo n.º 5
0
 /**
  * @param string $cssContent
  * @param callback $inlineCallback
  * @param string $expectedResult
  * @dataProvider replaceRelativeUrlsDataProvider
  */
 public function testReplaceRelativeUrls($cssContent, $inlineCallback, $expectedResult)
 {
     $actual = $this->object->replaceRelativeUrls($cssContent, $inlineCallback);
     $this->assertEquals($expectedResult, $actual);
 }