Last active
September 23, 2018 08:11
-
-
Save jermainee/31fa2049188fc5e40b35722299d30bf5 to your computer and use it in GitHub Desktop.
Quick and dirty cli script to bundle JavaScript files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = './js/'; | |
// Bundle the JavaScript files in the right order | |
$files = [ | |
'jquery.min.js', | |
'jquery.scrollzer.min.js', | |
'jquery.scrolly.min.js', | |
'util.js', | |
'main.js', | |
]; | |
$contents = ''; | |
echo "Reading file contents:\n"; | |
foreach ($files as $file) { | |
echo '-> ' . $file . "\n"; | |
$contents .= file_get_contents($dir . $file); | |
} | |
// Cookie Consent | |
// echo "-> Cookie Consent\n"; | |
// $contents .= file_get_contents('https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js'); | |
// $contents .= file_get_contents($dir . 'cookie-consent.js'); | |
echo "Writing bundle\n"; | |
file_put_contents("bundle.js", $contents); | |
echo "Finished!\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment