I have some AMD / Require.js questions. I'm pretty new to modular js and AMD, so it would be great if someone could give me a hand with this.
Let's say that I have 2 distinct areas on my system, defined as modules ("define()" function - I'm using Backbone, btw )
- Books
- BookItemView.js
- BookModel.js
- BookCollection.js
- DVDS
- DvdItemView.js
- DvdModel.js
- DvdCollection.js
I noticed that if the user is currently accessing the "Books" section of the site, the files from the DVD section are included by Require.js as well. I've got the following question:
- Is there some way to include only the files related to the active site section? There are some situations where the user is not interested to see the DVD list or even not allowed to do so. I would like to keep the server from making a unnecessary HTTP Request. Is there any chance to do this using Require.js?
Any ideas would be nice.