Skip to content

Instantly share code, notes, and snippets.

@benhowdle89
Created March 13, 2014 17:41
Show Gist options
  • Select an option

  • Save benhowdle89/9533185 to your computer and use it in GitHub Desktop.

Select an option

Save benhowdle89/9533185 to your computer and use it in GitHub Desktop.

Revisions

  1. benhowdle89 created this gist Mar 13, 2014.
    24 changes: 24 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    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();
    });