/** * Builds a compile filename for an asset with the * requested extension. * * @param \Assetic\Asset\AssetInterface $asset * @param string $extension * @return string */ public function getCompileFileName(AssetInterface $asset, $extension) { $cacheKey = ''; $assetName = ''; if ($asset instanceof AssetCollectionInterface) { switch ($extension) { case 'css': $assetName = 'styles'; break; case 'js': default: $assetName = 'scripts'; break; } foreach ($asset->all() as $actualAsset) { $cacheKey .= $this->getCacheKey($actualAsset); } } else { $assetName = $asset->getSlug(); $cacheKey .= $this->getCacheKey($asset); } if ($values = $asset->getValues()) { asort($values); $cacheKey .= serialize($values); } $lastModified = $asset->getLastModified(); return $assetName . '.' . md5($cacheKey) . '_' . $lastModified . ".{$extension}"; }