Source of file CssMinFilter.php
Size: 1,735 Bytes - Last Modified: 2013-06-02T00:13:43+02:00
/home/theseer/Downloads/Symfony/vendor/kriswallsmith/assetic/src/Assetic/Filter/CssMinFilter.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 | <?php /* * This file is part of the Assetic package, an OpenSky project. * * (c) 2010-2013 OpenSky Project Inc * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Assetic\Filter; use Assetic\Asset\AssetInterface; /** * Filters assets through CssMin. * * @link http://code.google.com/p/cssmin * @author Kris Wallsmith <kris.wallsmith@gmail.com> */ class CssMinFilter implements FilterInterface { private $filters; private $plugins; public function __construct() { $this->filters = array(); $this->plugins = array(); } public function setFilters(array $filters) { $this->filters = $filters; } public function setFilter($name, $value) { $this->filters[$name] = $value; } public function setPlugins(array $plugins) { $this->plugins = $plugins; } public function setPlugin($name, $value) { $this->plugins[$name] = $value; } public function filterLoad(AssetInterface $asset) { } public function filterDump(AssetInterface $asset) { $filters = $this->filters; $plugins = $this->plugins; if (isset($filters['ImportImports']) && true === $filters['ImportImports']) { $root = $asset->getSourceRoot(); $path = $asset->getSourcePath(); if ($root && $path) { $filters['ImportImports'] = array('BasePath' => dirname($root.'/'.$path)); } else { unset($filters['ImportImports']); } } $asset->setContent(\CssMin::minify($asset->getContent(), $filters, $plugins)); } } |