Skip to content

Commit

Permalink
sourcemaps with watchify
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Schoffstall committed Dec 12, 2014
1 parent 6a3b85f commit e463249
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/recipes/fast-browserify-builds-with-watchify.md
Expand Up @@ -9,7 +9,9 @@ Watchify doesn't have a gulp plugin, but it doesn't need one either: you can use
``` javascript
var gulp = require('gulp');
var gutil = require('gulp-util');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var watchify = require('watchify');
var browserify = require('browserify');

Expand All @@ -25,6 +27,11 @@ function bundle() {
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('bundle.js'))
// optional, remove if you dont want sourcemaps
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true})) // loads map from browserify file
.pipe(sourcemaps.write('./')) // writes .map file
//
.pipe(gulp.dest('./dist'));
}
```

0 comments on commit e463249

Please sign in to comment.