jmreidy/grunt-browserify — pull request #27 by bclinkinbeard (2013-04-18 08:08:54+00:00)
Title: Added options merging and beforeHook feature

I added ```var options = this.options()``` to merge task and target level options, and updated the checks and other features to use the new object instead of ```this.data```. This allows options common to multiple targets, like the ```src``` and ```dest``` properties for dev and release targets, to be specified once and shared.

The ```beforeHook``` feature allows things like ```browserify-shim``` to be run prior to bundling.

I did not add any tests yet, but if these changes look good I will. Sample configuration enabled by these changes below.

```
browserify: {
options: {
src: ['<%= cfg.src_dir %>/app.js', '<%= cfg.views_out %>'],
dest: '<%= cfg.dist_dir %>/app.js',
beforeHook: function( bundle ) {
shim( bundle, {
angular: { path: './src/components/angular/angular.js', exports: 'angular' },
Class: { path: './src/components/Class.js/Class.js', exports: 'Class' }
} );
}
},
dev: {
options: {
debug: true
}
},
release: {
options: {
debug: false
}
}
}
```