Вопрос

I'm using Substack's Watchify for better Browserify builds, within a Gulp watch task, like so:

var gulp = require('gulp');
var source = require('vinyl-source-stream');
var watchify = require('watchify');

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/'));
    }

    return rebundle();
});

Trying to figure out how I can incorporate Live Reload into the task, so it triggers when Watchify has done it's thing. Any idea how I would do this?

Это было полезно?

Решение

Have you tried using gulp-livereload right after your gulp.dest()?

You should be able simply insert this:

.pipe(livereload())

This assumes that bundler.bundle() pipes the correct data types.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top