We have just started using requirejs in our project and we are loving it. Currently we are just using it to manage our many jQuery plugins the site runs on, so are barely scratching the surface of its potential⦠but due to time constraints this has to wait.
I'm having some problems getting the optimizer play as I'd like it to, I wonder if you could tell me if it is even possible to do this. My directory structure:
> /common/
> /common/*.js - common plugins used on most pages on the site
> /infrequent/
> /infrequent/infrequentModule.js
> /infrequent/ckeditor
> /infrequent/ckeditor/1000s.js
> /require.js
> /jquery.js
> /main.js - this file contains all scripts in common. It looks at the page and call the necessary plugins.
Optimization/build hopes:
- main.js would contain all the common scripts. On most pages this script will be the only one loaded (except require.js)
- main.js looks at the page, if it see's that it needs an infrequent plugin/module it loads that async. So on a infrequent page I may load require.js, main.js and infrequentModule.js.
I have tried various methods in the build script to exclude and include files to get the desired results but to no avail. Does anyone have any ideas or know if this is, in fact, even possible?