Skip to content

Commit

Permalink
chore(plug-in): document configure + add prebundle removal warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Dec 21, 2014
1 parent 5c4e9bc commit d38fd2d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ There are three properties that are not passed directly:

* [transform](#transforms)
* [plugin](#plugins)
* [prebundle](#additional-bundle-configuration)
* [configure](#additional-bundle-configuration)

#### Transforms

Expand Down Expand Up @@ -91,12 +91,14 @@ The [browserify plugin](https://github.com/substack/node-browserify#bpluginplugi

#### Additional Bundle Configuration

You may perform additional configuration in a function that you pass as the `prebundle` option and that receives the bundle as an argument. This is useful when you need to set up things like [externals](https://github.com/substack/node-browserify#external-requires):
You may perform additional configuration in a function passed as the `configure` option and that receives the browserify instance as an argument. A custom `prebundle` event is emitted on the bundle right before a bundling operation takes place. This is useful when setting up things like [externals](https://github.com/substack/node-browserify#external-requires):

```javascript
browserify: {
prebundle: function(bundle) {
bundle.external('foobar');
configure: function(bundle) {
bundle.on('prebundle', function() {
bundle.external('foobar');
});
}
}
```
Expand Down Expand Up @@ -144,9 +146,10 @@ module.exports = function(karma) {
browserify: {
debug: true,
transform: [ 'brfs' ],
prebundle: function(bundle) {
// additional configuration, e.g. externals
bundle.external('foobar');
configure: function(bundle) {
bundle.on('prebundle', function() {
bundle.external('foobar');
});
}
}
});
Expand Down
6 changes: 6 additions & 0 deletions lib/bro.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ function Bro(bundleFile) {
'transform', 'plugin', 'configure', 'bundleDelay'
]));


if ('prebundle' in browserifyOptions) {
log.warn('The prebundle hook got removed in favor of configure');
}


var w = watchify(browserify(browserifyOptions));

_.forEach(bopts.plugin, function(p) {
Expand Down

0 comments on commit d38fd2d

Please sign in to comment.