Skip to content

Instantly share code, notes, and snippets.

@benhowdle89
Created July 10, 2014 11:20
Show Gist options
  • Save benhowdle89/22b8d3d0fdf6e7414f38 to your computer and use it in GitHub Desktop.
Save benhowdle89/22b8d3d0fdf6e7414f38 to your computer and use it in GitHub Desktop.
Gulp using Watchify
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var livereload = require('gulp-livereload');
var hbsfy = require("hbsfy").configure({
extensions: ["html"]
});
gulp.task('scripts', function() {
var bundler = watchify('./public/js/app.js');
bundler.transform(hbsfy);
bundler.on('update', rebundle);
function rebundle() {
return bundler.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./public/dist/js/')).pipe(livereload());
}
return rebundle();
});
// default gulp task
gulp.task('default', ['scripts']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment