divmain/js-seed — pull request #22 by baer (2014-11-10 18:42:42+00:00)
Title: Use injected build config to consolidate build-js and build-js-dev

This PR does 3 things:

* **Inject a configuration object into all Gulp tasks** This allows you to define project variables like Oauth secrets, DB Keys, GoogleAnalytics ids etc. in your project config and have that available to all tasks. Using a config object also allows you to set defaults that can be overridden as needed.
* **Use a project.env variable + CLI flag to clean up build-js** - I noticed that the ONLY difference between `build-js` and `build-js-dev` is the webpack config. To DRY things up I consolidated the two and used an env variable in the `project.config.js` file. I also added minimist so that certain config can be overridden with [simple CLI flags](https://github.com/gulpjs/gulp/blob/master/docs/recipes/pass-arguments-from-cli.md). Aside from webpack configuration there may be a number of credentials and keys across many parts of the build (API sandbox endpoint vs. production for example) that will need to be toggled based on env as a project grows and I think that this is a pretty clean way to do it.
* **Convert all the gulp tasks into modules again** - Since they need to take an argument I had to change them all back :) No tasks besides `build-js` were actually modified other than wrapping in a function but you can that whitespace flag again to see for yourself.