Skip to content

Instantly share code, notes, and snippets.

@luke-denton-aligent
Created October 12, 2017 04:31
Show Gist options
  • Save luke-denton-aligent/3b05af6804d3ee1eb80db8f13dd11688 to your computer and use it in GitHub Desktop.
Save luke-denton-aligent/3b05af6804d3ee1eb80db8f13dd11688 to your computer and use it in GitHub Desktop.
A snippet of code to be added to the \Magento\Framework\View\Asset\Bundle\Manager::isValidAsset function, to create a list of JS files associated with an M2 storefront
$destinationFile = "assets/js.txt";
$name = $asset->getPath();
$nameParts = explode('.', $name);
$extension = array_pop($nameParts);
if ($extension == 'js') {
file_put_contents($destinationFile, $name.PHP_EOL , FILE_APPEND | LOCK_EX);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment