예제 #1
0
 /**
  * Process an asset before merging into resulting asset
  *
  * @param Asset\LocalInterface $item
  * @param Asset\LocalInterface $result
  * @param string $content
  * @return string
  */
 private function preProcessBeforeMerging(Asset\LocalInterface $item, Asset\LocalInterface $result, $content)
 {
     if ($result->getContentType() == 'css') {
         $from = $item->getPath();
         $to = $result->getPath();
         return $this->cssUrlResolver->relocateRelativeUrls($content, $from, $to);
     }
     return $content;
 }
예제 #2
0
 public function testRelocateRelativeUrls()
 {
     $relatedPath = '/some/directory/two/another/file.ext';
     $filePath = '/some/directory/one/file.ext';
     $fixturePath = __DIR__ . '/_files/';
     $source = file_get_contents($fixturePath . 'source.css');
     $result = file_get_contents($fixturePath . 'resultNormalized.css');
     $this->assertEquals($result, $this->object->relocateRelativeUrls($source, $relatedPath, $filePath));
 }