Created
July 10, 2014 11:20
-
-
Save benhowdle89/22b8d3d0fdf6e7414f38 to your computer and use it in GitHub Desktop.
Gulp using Watchify
This file contains hidden or 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 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