Skip to content

Instantly share code, notes, and snippets.

@Cside
Created December 24, 2016 11:47
Show Gist options
  • Save Cside/14963f34e0a11580426c26b6f0f1a3a6 to your computer and use it in GitHub Desktop.
Save Cside/14963f34e0a11580426c26b6f0f1a3a6 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var webserver = require('gulp-webserver');
gulp.task('browserify', function() {
browserify('./src/index.js', { debug: true })
.transform(babelify)
.bundle()
.on("error", function (err) { console.log("Error : " + err.message); })
.pipe(source('bundle.js'))
.pipe(gulp.dest('./'))
});
gulp.task('watch', function() {
gulp.watch('./src/**/*.js', ['browserify'])
});
gulp.task('webserver', function() {
gulp.src('./')
.pipe(webserver({
host: '127.0.0.1',
livereload: true
})
);
});
gulp.task('default', ['browserify', 'watch', 'webserver']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment