Phulp\Source::addDistFile PHP Method

addDistFile() public method

public addDistFile ( DistFile $distFile )
$distFile DistFile
    public function addDistFile(DistFile $distFile)
    {
        $this->distFiles->add($distFile);
    }

Usage Example

Example #1
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'));
     }
 }