/**
  * @inheritdoc
  */
 public function execute(Source $src)
 {
     foreach ($src->getDistFiles() as $key => $file) {
         if (preg_match('/\\.less$/', $file->getName()) || preg_match('/\\.less$/', $file->getDistpathname())) {
             $parser = new Less_Parser();
             $parser->parseFile($file->getFullpath() . DIRECTORY_SEPARATOR . $file->getName(), $this->options['uri']);
             $css = $parser->getCss();
             $file->setContent($css);
             $file->setDistpathname(preg_replace('/less$/', 'css', $file->getDistpathname()));
         }
     }
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function execute(Source $src)
 {
     $min = new JS();
     foreach ($src->getDistFiles() as $key => $file) {
         if (preg_match('/js$/', $file->getName()) || preg_match('/js$/', $file->getDistpathname())) {
             if (!$this->options['join']) {
                 $min = new JS();
             }
             $min->add($file->getContent());
             if (!$this->options['join']) {
                 $file->setContent($min->minify());
             } else {
                 $src->removeDistFile($key);
             }
         }
     }
     if ($this->options['join']) {
         $src->addDistFile(new DistFile($min->minify(), md5(uniqid(microtime())) . '.js'));
     }
 }