Last active
August 29, 2015 14:07
-
-
Save danihodovic/8c828a0f39cff4e51fb2 to your computer and use it in GitHub Desktop.
Browserify + Esnext + Watch + Errorhandling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp') | |
var source = require('vinyl-source-stream') | |
var buffer = require('vinyl-buffer') | |
var browserify = require('browserify') | |
var esnext = require('gulp-esnext') | |
var notify = require('gulp-notify') | |
var build_dir = './bin' | |
var browserify_input = './main.js' | |
var browserify_output = './app.js' | |
gulp.task('main', function() { | |
browserify(browserify_input, {}) | |
.bundle() | |
.on('error', notify.onError(function(err) { | |
return err.message; | |
})) | |
.pipe(source(browserify_output)) | |
.pipe(buffer()) | |
.pipe(esnext()) | |
.pipe(gulp.dest(build_dir)) | |
.pipe(notify({ | |
title: 'Finished', | |
message: 'Build complete' | |
})); | |
}) | |
gulp.task('watch', function() { | |
gulp.watch('./*.js', ['main']) | |
}) | |
gulp.task('default', ['main', 'watch']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment