簡體   English   中英

使用Watchify集成gulp-livereload

[英]Integrate gulp-livereload with Watchify

我正在使用Substack的Watchify在Gulp監視任務中獲得更好的Browserify構建,如下所示:

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();
});

試圖找出如何將Live Reload合並到任務中,以便在Watchify完成它的時候觸發它。 知道怎么做嗎?

您是否嘗試過gulp.dest()之后gulp.dest()使用gulp-livereload

你應該能夠簡單地插入:

.pipe(livereload())

這假設bundler.bundle()管道正確的數據類型。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM