Source of file JsCompressorFilter.php
Size: 1,411 Bytes - Last Modified: 2013-06-02T00:13:43+02:00
/home/theseer/Downloads/Symfony/vendor/kriswallsmith/assetic/src/Assetic/Filter/Yui/JsCompressorFilter.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | <?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\Yui; use Assetic\Asset\AssetInterface; /** * Javascript YUI compressor filter. * * @link http://developer.yahoo.com/yui/compressor/ * @author Kris Wallsmith <kris.wallsmith@gmail.com> */ class JsCompressorFilter extends BaseCompressorFilter { private $nomunge; private $preserveSemi; private $disableOptimizations; public function setNomunge($nomunge = true) { $this->nomunge = $nomunge; } public function setPreserveSemi($preserveSemi) { $this->preserveSemi = $preserveSemi; } public function setDisableOptimizations($disableOptimizations) { $this->disableOptimizations = $disableOptimizations; } public function filterDump(AssetInterface $asset) { $options = array(); if ($this->nomunge) { $options[] = '--nomunge'; } if ($this->preserveSemi) { $options[] = '--preserve-semi'; } if ($this->disableOptimizations) { $options[] = '--disable-optimizations'; } $asset->setContent($this->compress($asset->getContent(), 'js', $options)); } } |