I’m still working on the build process to speed up the actual build by requirejs in grunt. Currently the speed is about 20-25 seconds and I think that just to slow if a bug is found due to a build issue and debugging has to be done with the build itself.
For the production portion, I’m using a fairly basic require script structure which loads the common files, which then loads the backbone app loader which contains the app and base app. This limits the request down to 2 files and allows the common file to be loaded by itself on the homepage and on any page that isn’t using a backbone app but still requires jquery and other similar libraries. This structure allows for a faster load time, cacheable libraries but individual app files.
For the development portion, I’m using a different require script structure (determined by the application) which loads the backbone app, which loads the backbone base app, which loads the common file.
http://backbonetutorials.com/organizing-backbone-using-modules/
https://github.com/gruntjs/grunt-contrib-requirejs
http://www.webdeveasy.com/optimize-requirejs-projects/
https://github.com/requirejs/example-multipage/blob/master/tools/build.js
http://robdodson.me/a-require-dot-js-multipage-shimmed-site-how-to/
https://github.com/requirejs/example-multipage-shim/blob/master/www/page1.html
http://www.erikschierboom.com/2014/11/17/requirejs/
http://5minutenpause.com/blog/2014/08/18/a-gruntfile-for-frontend-developers/
http://jaketrent.com/post/dynamically-require-optimized-modules-requirejs/
https://www.npmjs.com/package/grunt-concurrent
Continue reading Grunt and RequireJS