RaveJS/rave — pull request #61 by unscriptable (2014-08-22 17:45:33+00:00)
Title: Very simple build attempt

This would be an attempt at a super simple build -- a proof of concept, really. The term "quick and dirty" is not beyond the lexicon that might be used during this attempt. :) What this POC will prove:

- Rave can be used to load bundled modules and resources (js, css, html, etc.).
- Rave can reduce and/or eliminate build-time configuration.
- Rave can automate tasks necessary to switch between [responsive and built modes](https://github.com/RaveJS/rave/blob/master/docs/developing.md#building-your-app)
- Devs can install (and third-party authors can create) rave extensions to allow different build strategies.

After some discussion with @briancavalier, we decided that it would be easiest to create an ES5 bundle in the first attempt. In other words, create an AMD or browserify bundle. TBH, both browserify and AMD are far from ideal, but would be way easier than attempting an ES6-ish option at this point.

Given my extensive experience with cram.js and AMD -- as well as some recent problems (#52) and my total lack of knowledge of browserify bundles -- I decided to try AMD first. I suspect I'll be much more productive with the stuff I know intimately. If attempts via cram go badly, I'll research our options with browserify asap.

The first commit in this PR is (part 1 of 2) that will allow AMD bundles to be loaded. (This is functionality we may have had to write anyways and is relatively easy to implement in the AMD-specific modules.)

We also decided to try to leverage gulp because of its popularity and its use of streams.

Still to do, but not necessarily in order:

- [ ] Create a gulp file to automate the creation of an AMD bundle via cram (or browserify).
- [ ] Create a gulp file to swap/rewrite boot.js.
- [ ] Create a gulp file to switch modes (responsive <--> built), which just runs the other gulp tasks.
- [ ] Bundle text, css, and json via a new cram plugin that maps extensions to text, css, and json cram plugins.
- [ ] Extract the build-related code out of rave and put it into a new rave extension repo (e.g. rave-build-cram or rave-build-browserify). (Users will `npm install` these extensions.)
- [ ] Replace with debug code that instructs the user how to find and install a rave-build-* extension.
- [ ] Refactor any "quick and dirty" code, ensure test coverage, etc.

Possible follow-on tasks, probably not in this PR, but here for discussion:

- [ ] Create a gulp file that rewrites index.html, rather than swaps boot.js.
- [ ] Create ES6-ish rave-build-* extensions.
- [ ] Allow multiple rave-build-* extensions to co-exist in the same repo, allowing parts of one extension to be overridden by the other extensions.

I'll be updating this description from time to time as tasks are clarified, added, or removed. Comments welcome, as usual.