Closed SimplGy closed 11 years ago
Hey Eric!
I agree this is confusing. I'm not a big fan of paths: {}
. It's not clear to users where the line between urls and ids is drawn. In fact, I think the AMD config spec is just plain broken. :(
I'm rewriting the documentation regarding paths and packages. Here are the rules I use to decide which to use:
If you want to specify the location of a single module, use paths. If you want to specify the location of several related modules, use packages. If you want to specify the location of several unrelated modules, use paths or packages.
curl({
baseUrl: '',
packages: [
{ name: 'app': location: '../shared/appCore/app', main: 'app' }
]
});
curl(['app']).then(function(app) {
app.start()
});
Try that! :)
-- J
Very interesting, John. The AMD config spec certainly seems odd. If there are rules they don't fit my intuition.
This may just be my perspective, but as a front-end oriented developer, I'm used to things being urls only. It took me a few reads of your explanation to figure out first that there is some kind of difference between id and url, and second what that kind of conceptual difference might imply. Since everything in my world up to this point has been a url, I am used to expecting everything to behave that way.
The package concept though, is very interesting. Its probably a better fit for the intent of what we're doing with these groups of similar files. We'll dance our merry way in that direction and thank you very much for your stewardship of this awesome project.
Thanks for your continued support and feedback, Eric! It's much appreciated.
Just so you know, I am recently aware that there's a serious understanding problem concerning paths, urls, and ids. I'm starting to formulate a plan to overcome this problem. Please keep the conversation going here and/or on the cujojs google group as you start to think more about packages.
Regards,
-- John
This seems pretty tricky, but I think maybe it's actually not. Needs code to explain though :)
Take this folder structure:
...This curl config:
...And this bootstrap in index.html:
The relative dependencies specified in /shared/appCore/app.js are calculated differently depending on whether I use the shortcut path 'app' to include it or the full version '..shared/appCore/app'. (the long version makes relative paths work the way I'd expect).
This happens in 0.6.2, and also when I upgraded to 0.7.2.
If the shortcut 'app' is used, relative paths (like './app.config'), which would be so nice to be able to use, begin at the wrong context.