Skip to content

Instantly share code, notes, and snippets.

@jermainee
Last active September 23, 2018 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jermainee/31fa2049188fc5e40b35722299d30bf5 to your computer and use it in GitHub Desktop.
Save jermainee/31fa2049188fc5e40b35722299d30bf5 to your computer and use it in GitHub Desktop.
Quick and dirty cli script to bundle JavaScript files
<?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