Created
March 13, 2014 17:41
-
-
Save benhowdle89/9533185 to your computer and use it in GitHub Desktop.
Gulp + Watchify + Browserify + Handlebars + LiveReload
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 watchify = require('watchify'); | |
var livereload = require('gulp-livereload'); | |
var hbsfy = require("hbsfy").configure({ | |
extensions: ["html"] | |
}); | |
gulp.task('watch', 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(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this work if the templates are changed? Can you please confirm? For us it only reloads and rebuilds changes to the .js files.