Skip to content

Question about usage #105

Open
Open

Description

@kamov

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

Activity

  1. boye commented on Mar 13, 2017

    @boye
    Contributor

    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
    });
  2. kamov commented on Mar 13, 2017

    @kamov
    Author

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions