anthonyshort/grunt-component-build — pull request #23 by anthonyshort (2013-08-29 05:19:40+00:00)
Title: Refactor for better Grunt 0.4.0 API usage

Bit of a refactor to use the Grunt 0.4.0 file and options APIs. This makes it much easier to create dynamic builds and keeps it consistent with every other grunt plugin out there.

* I've separated the grunt and component-build functionality. This makes it easier to digest.
* Renamed the task to `componentbuild` to make it JShint/lint friendlier and consistent with other plugins
* Using `src` and `dest` instead of `base` and `output`
* Using `options` instead of just properties on the task. This allows us to use the Grunt options API and it will do some automatic merging on options so you can have global options for all tasks and override them on individual ones.
* Removed a lot of the unnecessary timing and file size output. Sorry, this belongs in other grunt plugins and is easy to implement eg. `grunt-bytesize`. I want this task to only do one thing.
* Removed the built-in plugins

All tests are still passing. Had to modify the Gruntfile with the new options syntax, but everything is working the way it was before.

The big thing this allows us to do is use the [File API](http://gruntjs.com/configuring-tasks#files):

```js
componentbuild: {
options: {
dev: true,
sourceUrls: true
},
scripts: {
options: {
name: 'dev'
},
src: [{
expand: true,
src: ['my-components/*'],
dest: 'build/'
}]
}
}
```

Now you can drop new components into `my-components` and they'll automatically get built into their own relative `build` directory without needing to specify each one. On large projects with many builds for different areas of the site, it's super nice.

/cc @kewah