Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about usage #105

Open
kamov opened this issue Mar 13, 2017 · 2 comments
Open

Question about usage #105

kamov opened this issue Mar 13, 2017 · 2 comments

Comments

@kamov
Copy link

kamov commented Mar 13, 2017

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

@boye
Copy link
Contributor

boye commented Mar 13, 2017

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
});

@kamov
Copy link
Author

kamov commented Mar 13, 2017

@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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants