コード例 #1
0
ファイル: CssRewriteUrlFilter.php プロジェクト: ejailesb/repo
 /**
  * {@inheritdoc}
  */
 public function filterContent(AssetInterface $asset)
 {
     // has path?
     if (!($path = $asset->getOption('path'))) {
         return;
     }
     // set base path
     $this->path = dirname($this->url->to($path)) . '/';
     $asset->setContent(preg_replace_callback('/url\\(\\s*[\'"]?(?![a-z]+:|\\/+)([^\'")]+)[\'"]?\\s*\\)/i', array($this, 'rewrite'), $asset->getContent()));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function filterContent(AssetInterface $asset)
 {
     // has path?
     if (!($path = $asset->getOption('path'))) {
         return;
     }
     // resolve @import rules
     $content = $this->load($path, $asset->getContent());
     // move unresolved @import rules to the top
     $comments = array();
     $regexp = '/@import[^;]+;/i';
     $content = $this->replaceComments($content, $comments);
     if (preg_match_all($regexp, $content, $matches)) {
         $content = preg_replace($regexp, '', $content);
         $content = implode("\n", $matches[0]) . "\n" . $content;
     }
     $content = $this->restoreComments($content, $comments);
     $asset->setContent($content);
 }