/**
* @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'));
}
}