コード例 #1
0
ファイル: LazyAsset.php プロジェクト: puli/assetic-extension
 /**
  * {@inheritdoc}
  */
 public function load(FilterInterface $additionalFilter = null)
 {
     if (!$this->innerAsset) {
         $this->createInnerAsset();
     }
     return $this->innerAsset->load($additionalFilter);
 }
コード例 #2
0
 public function dump(AssetInterface $asset)
 {
     $writer = new \Assetic\AssetWriter(sys_get_temp_dir(), $this->container->getParameter('assetic.variables'));
     $ref = new \ReflectionMethod($writer, 'getCombinations');
     $ref->setAccessible(true);
     $name = $asset->getSourcePath();
     $type = substr($name, strrpos($name, '.') + 1);
     switch ($type) {
         case 'coffee':
             $asset->ensureFilter($this->container->get('assetic.filter.coffee'));
             $type = 'js';
             break;
         case 'less':
             $asset->ensureFilter($this->container->get('assetic.filter.less'));
             $type = 'css';
             break;
     }
     $combinations = $ref->invoke($writer, $asset->getVars());
     $asset->setValues($combinations[0]);
     $asset->load();
     $content = $asset->getContent();
     // because the assetic cssrewrite makes bullshit here, we need to reimplement the filter
     if ($type === 'css') {
         $content = $this->cssFilter($content, '/' . dirname($asset->getSourcePath()));
     }
     return $content;
 }
コード例 #3
0
 /**
  * Loads the asset into memory and applies load filters.
  *
  * @param FilterInterface|null $additionalFilter
  */
 public function load(FilterInterface $additionalFilter = null)
 {
     $cacheKey = $this->getCacheKey($this->asset, $additionalFilter, 'load');
     if ($this->cache->has($cacheKey)) {
         $this->asset->setContent($this->cache->get($cacheKey));
         return;
     }
     $this->asset->load($additionalFilter);
     $this->cache->set($cacheKey, $this->asset->getContent());
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function load(FilterInterface $additionalFilter = null)
 {
     return $this->asset->load($additionalFilter);
 }