Skip to content

Commit

Permalink
fix #27 source maps issue in watch mode. Closes #14 as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
Granze committed Dec 16, 2015
1 parent e7b8613 commit 85bbb62
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const paths = {
distImg: 'dist/images'
};

const customOpts = {
entries: [paths.srcJsx],
debug: true
};

const opts = Object.assign({}, watchify.args, customOpts);

gulp.task('clean', cb => {
rimraf('dist', cb);
});
Expand All @@ -44,13 +51,15 @@ gulp.task('browserSync', () => {
});

gulp.task('watchify', () => {
let bundler = watchify(browserify(paths.srcJsx, watchify.args));
let bundler = watchify(browserify(opts));

function rebundle() {
return bundler
.bundle()
return bundler.bundle()
.on('error', notify.onError())
.pipe(source(paths.bundle))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.distJs))
.pipe(reload({stream: true}));
}
Expand All @@ -61,12 +70,12 @@ gulp.task('watchify', () => {
});

gulp.task('browserify', () => {
browserify(paths.srcJsx)
browserify(paths.srcJsx, {debug: true})
.transform(babelify)
.bundle()
.pipe(source(paths.bundle))
.pipe(buffer())
.pipe(sourcemaps.init())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.distJs));
Expand Down

0 comments on commit 85bbb62

Please sign in to comment.