Skip to content

Instantly share code, notes, and snippets.

@benhowdle89
Created March 13, 2014 17:41
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benhowdle89/9533185 to your computer and use it in GitHub Desktop.
Save benhowdle89/9533185 to your computer and use it in GitHub Desktop.
Gulp + Watchify + Browserify + Handlebars + LiveReload
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();
});
@levino
Copy link

levino commented Oct 13, 2015

Does this work if the templates are changed? Can you please confirm? For us it only reloads and rebuilds changes to the .js files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment