My single biggest aversion to build tools like browserify and r.js is this... how do I package portions of a site into separate files?
Generally I have something like the following...
init.js - in the head, modernizr, css-browser shims etc
jquery.js - before /body
site.js - site-wide functionality
section.js - functionality for a section of the site
page.js - functionality for that specific page
This allows me to cache/reuse common functionality and still have a limited number of http requests for js... how would I accomplish this with requirejs, browserify and the rest?
From what I've seen you can't. Ideally, I'd like to be able to package harmony-style modules.. there's some transpilers for that structure already. It would just be nice to be able to reliably package sections for downlevel reuse without having one huge script per page in a site that is expressly not single page.
you can do that with [1] browserify bundles. Basically you tell the script not to package modules that get required and instead use ones defined elsewhere, like in another include.
Generally I have something like the following...
This allows me to cache/reuse common functionality and still have a limited number of http requests for js... how would I accomplish this with requirejs, browserify and the rest?From what I've seen you can't. Ideally, I'd like to be able to package harmony-style modules.. there's some transpilers for that structure already. It would just be nice to be able to reliably package sections for downlevel reuse without having one huge script per page in a site that is expressly not single page.