Hi,
I am prototyping a curl + cram application and would like to break the application into multiple bundles. There would be an initial bootstrap bundle which would contain shared code and then based on what the user does, would load other dynamic bundles on the fly. Think about a rarely used dialog that has js, css and html in it. I would put that in its own dynamic bundle and load it "on demand" making the user pay the cost only when they need to. There could be multiple such dynamic bundles that could be loaded. I have this sort of working now like this:
My bootstrap bundle references all shared code and plugins that the dynamic bundles might reference.
Dynamic bundles are built with cram by specifying the root javascript file using --include and using --exclude to exclude the shared javascript modules that are already loaded in the bootstrap bundle. Cram produces a single file with a bunch of define() blocks in it.
When I want to load the dynamic module, I use curl and the js plugin to load the dynamic module. Once the js is loaded, I can use curl again to access any module from the dynamic bundle since they are now loaded.
So this seems to be working with one small problem - the js plugin gets loaded a second time when the dynamic bundle is loaded even though it is referenced by the bootstrap bundle. I can actually live with this extra cost but I would like to have it work perfectly if I can. So a few questions for the group:
1) Any thoughts/feedback on my strategy above?
2) Any thoughts on why the js plugin gets loaded a second time? Any tips/pointers for me to debug/fix this would be great.
Thanks for any help!
Chris Hafey
PS - It looks excludes is currently broken in cram (e.g. --exclude Foo.js will cause it to crash). I am working around this by using a json config object that looks like this:
{
"excludes" : {
"Foo" : true
}
}