示例#1
0
 public function applyFilters(Asset $asset)
 {
     if (!isset($this->filters[$asset->getExtension()]) || !is_array($this->filters[$asset->getExtension()])) {
         return;
     }
     foreach ($this->filters[$asset->getExtension()] as $filter) {
         // When parameters are passed as an array,
         // the first is the name of the class,
         // while the others are parameters that are passed
         // into the class constructor
         if (is_array($filter)) {
             $class_name = $filter[0];
             if (!isset($filter[1])) {
                 $filter[1] = null;
             }
             $class = new $class_name($filter[1]);
         } else {
             $class = new $filter();
         }
         $class->run($asset);
         unset($class);
     }
 }
示例#2
0
 public function run(Asset $asset)
 {
     $contents = \JSMin::minify($asset->getContent());
     $asset->setContent($contents);
 }
示例#3
0
 public function run(Asset $asset)
 {
     $contents = $asset->getContent();
     $contents = \CssMin::minify($contents, $this->filters, $this->plugins);
     $asset->setContent($contents);
 }