Skip to content

Commit

Permalink
Update fast-browserify-builds-with-watchify.md
Browse files Browse the repository at this point in the history
  • Loading branch information
koistya committed Feb 20, 2014
1 parent 2d5ad8f commit cd7e6de
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions docs/recipes/fast-browserify-builds-with-watchify.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,26 @@ 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 bundler = watchify('./src/index.js')
gulp.task('watch', function () {
var bundler = watchify('./src/index.js');

// Optionally, you can apply transforms
// and other configuration options on the
// bundler just as you would with browserify
bundler.transform('brfs')

gulp.task('browserify', rebundle)
gulp.task('watch', ['browserify'], function() {
bundler.on('update', rebundle)
})

function rebundle() {
return bundler.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./dist'))
}
function rebundle () {
return bundler.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./dist'))
}

// Optionally, you can apply transforms
// and other configuration options on the
// bundler just as you would with browserify
bundler.transform('brfs')
return rebundle()
})
```

0 comments on commit cd7e6de

Please sign in to comment.