Techwraith/atomify — pull request #7 by bclinkinbeard (2014-02-17 03:21:41+00:00)
Title: New API and CLI

OK, so this is the bulk of the refactor we talked about. If we're all good with it I will go ahead with the help text and readme updates and stuff.

The API is basically the same, it expects a config object with a `js` property, a `css` property, or both, and a callback function. What I ended up doing with the callback is making it so the one provided is called with a third parameter of 'js' or 'css' depending on which option it is for. `require('atomify').js` exposes `atomify-js`, `require('atomify').css` exposes `atomify-css`, and `require('atomify').http` exposes the http server like we talked about.

Perhaps more interestingly, the CLI is pretty bad ass now. :) Thanks to `subarg`, you can do all of the following.

```
atomify -j entry.js -c entry.css -o bundle
atomify -j [ entry.js bundle.js ] -c [ index.css styles.css ]
atomify -j [ -e entry.js -d -w -t funkify ] -c [ -e index.css -p rework-calc -p rework-grid ] -o bundle
atomify -j [ -e entry.js -e entry-two.js -o bundle.js ] -c [ index.css -o styles.css ]
```

Despite all of that this module does basically nothing. It plucks the `js` and `css` properties off of the options it gets and passes them to the `-js` and `-css` modules, and wraps a closure around the callback and that is it. The large majority of the CLI work is handled by `subarg`; all we do manually is a bit of aliasing and translation of the properties that can be specified a few different ways.

So take a look, and let me know what you think. The files primarily of interest are `index.js`, `bin/atomify.js` and `lib/cli.js`.

/cc @Techwraith @ben-ng @mwbrooks