Question about usage
I have one minified files vendor.js with all third party script like jquery, bootstrap, etc.. Then I have one main.js files with custom script.
Using your plugin it this can be loaded like:
$script('path/to/vendor.js', 'vendor', function() {
$script('path/to/main.js', 'main');
});
Can I use this way or is better separate vendor files?
Thanks
You can use $script.order as well. It's not really documented but it works just as expected. For example:
$script.order(['path/to/vendor.js', 'path/to/main.js'], function () {
// callback logic
});
@boye thanks.. However my questions is another. Performance change if I load multiple files or just one single file? Maybe multiple files is loaded more fast since is loaded in parallel? Since I could just load one main file vendor + main for all pages, I could just use something like this:
var r = document.getElementsByTagName( "script" )[ 0 ], s = document.createElement( "script" ); s.src = 'all.js'; r.parentNode.insertBefore( s, r );