/** * {@inheritdoc} */ public function load(FilterInterface $additionalFilter = null) { if (!$this->innerAsset) { $this->createInnerAsset(); } return $this->innerAsset->load($additionalFilter); }
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; }
/** * 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()); }
/** * {@inheritdoc} */ public function load(FilterInterface $additionalFilter = null) { return $this->asset->load($additionalFilter); }