Skip to content

Commit

Permalink
update docs for watchify, closes gulpjs#488
Browse files Browse the repository at this point in the history
  • Loading branch information
yocontra committed Jun 27, 2014
1 parent d1481ec commit 37143f3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions docs/recipes/fast-browserify-builds-with-watchify.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ use [vinyl-source-stream](http://github.com/hughsk/vinyl-source-stream) to pipe
the bundle stream into your gulp pipeline.

``` javascript
var gulp = require('gulp')
var source = require('vinyl-source-stream')
var watchify = require('watchify')
var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var watchify = require('watchify');

gulp.task('watch', function() {
var bundler = watchify('./src/index.js');
Expand All @@ -29,9 +30,13 @@ gulp.task('watch', function() {
bundler.transform('brfs')

bundler.on('update', rebundle)

function rebundle () {
return bundler.bundle()
// log errors if they happen
.on('error', function(e) {
gutil.log('Browserify Error', e);
})
.pipe(source('bundle.js'))
.pipe(gulp.dest('./dist'))
}
Expand Down

0 comments on commit 37143f3

Please sign in to comment.