Pipe\Environment::setCssCompressor PHP Method

setCssCompressor() public method

Adds the compressor class as bundle processor for CSS files. See $compressors for all available compressors.
public setCssCompressor ( string $compressor )
$compressor string Identifier of the compressor
    function setCssCompressor($compressor)
    {
        if (!isset($this->compressors[$compressor])) {
            throw new \InvalidArgumentException(sprintf('Undefined compressor "%s"', $compressor));
        }
        $css = $this->contentType('.css');
        if ($this->cssCompressor !== null) {
            $this->bundleProcessors->unregister($css, $this->compressors[$this->cssCompressor]);
        }
        $this->cssCompressor = $compressor;
        $this->bundleProcessors->register($css, $this->compressors[$compressor]);
    }

Usage Example

Example #1
0
File: Config.php Project: chh/pipe
 function createEnvironment()
 {
     $env = new Environment();
     $loadPaths = $this->loadPaths ?: array();
     foreach ($loadPaths as $path) {
         $env->appendPath(dirname($this->filename) . "/" . $path);
     }
     if (!$this->debug) {
         if ($jsCompressor = $this->jsCompressor) {
             $env->setJsCompressor($jsCompressor);
         }
         if ($cssCompressor = $this->cssCompressor) {
             $env->setCssCompressor($cssCompressor);
         }
     }
     return $env;
 }
All Usage Examples Of Pipe\Environment::setCssCompressor