include

3 views
Skip to first unread message

Shanimal

unread,
Feb 16, 2012, 1:42:56 PM2/16/12
to Jingo Users
I don't like the idea of managing dependency locations inside a file,
but it would be nice to have a method to include dependencies for
jquery, underscore, and other third party libraries without having to
"jingoize" those libraries. I was thinking something along the lines
of include or insert:

http://pastebin.com/CrJhg7yV

Right now I just assume I need them and include them in script tags at
the top of the page, but that's not dependency mgmt. :)

Sean Duncan

unread,
Feb 16, 2012, 2:11:20 PM2/16/12
to Jingo Users
Unfortunately that is really just a syntactic alternative to script
tags suffering from the same need for manual dependency management.
for example:

jingo.init({
repos: {
main:'./'
},
inc: {
jqueryui: 'https://ajax.googleapis.com/ajax/libs/jqueryui/
1.8.16/jquery-ui.min.js'.
jquery: 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/
jquery.min.js',
underscore: './js/underscore/underscore.js'
}
});

This is broken because I've "included" jqueryui before its dependency
jquery. I could fix it by reordering them, but that isn't any closer
to dependency management than managing the script tags myself.

The reason this fails is that jqueryui file doesn't define its own
dependencies "except in its project documentation". Neither do jquery
or underscore but they get away with it because they don't have any
dependencies. Through the trivial exercise of wrapping these in jingo
module envelopes I get to say goodbye to manual dependency
management. If I don't want to do that I can manage them myself via
script tags. There is certainly nothing wrong with that approach
particularly if you want to load them from google's CDN.
Reply all
Reply to author
Forward
0 new messages