allow someway to control resource load order #249

vicapow opened this Issue Mar 20, 2013 · 3 comments


None yet

3 participants

vicapow commented Mar 20, 2013

this may be an issue with asset-rack but how can the load order of files be set? for example, i want to use bootstrap.js but it depends on jQuery to be loaded first. however, bootstrap.js comes before jquery.min.js when the files are served into the template (because b comes before j) the only way around this i found was to rename the files (to something like __jquery.min.js and _bootstrap.js)

Tidwell commented Mar 20, 2013

#242 is the relevant existing issue.

I have taken to organizing my client side structure, a bit more rigidly - one project i have using angular + boostrap is using this:


vendor being dependancies (further sorted by library if needed, ex bootsrap folder and angular folder), core being library stuff and custom shims/etc, and ng being angular app stuff - it follows the angular-express-seed convention, just with folders instead of files

for a temporary fix for your example, you could do:


then set your asset config to:

module.exports.assets = {
    sequence: [

However. I tend to choose to cdn-host both jquery and bootstrap, and put those script tags into the document directly before my <%- assets.js() %> call - it might be worth it to just do that, especially if your scripts are already in a partial or your layout view.

vicapow commented Mar 20, 2013

oh, that's a good idea. thanks for sharing! (I'll close this issue since it's a duplicate.)

@vicapow vicapow closed this Mar 20, 2013

I'm interested in the possibility of adding an option to push all js/images/css out to a cdn in production mode-- made an issue. It's a low priority optimization IMO; would be awesome, but there's more pressing features that will make our lives easier. If anyone has energy about it and wants to tackle, please feel free. See #252.

And thanks @Tidwell for jumping in to help here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment