public function aggregateScripts($package, array $scripts, $file)
{
$assets = $this->newAssetCollection();
foreach ($scripts as $script) {
// Collect each candidate from a glob file search.
$path = $this->getVendorDir($package) . DIRECTORY_SEPARATOR . $script;
$matches = $this->fs->recursiveGlobFiles($path);
foreach ($matches as $match) {
$assets->add(new FileAsset($match));
}
}
$js = $assets->dump();
// Write the file if there are any JavaScript assets.
if (!empty($js)) {
$destination = $this->componentDir . DIRECTORY_SEPARATOR . $file;
$this->fs->ensureDirectoryExists(dirname($destination));
return file_put_contents($destination, $js);
}
return false;
}