0
しばらくwatchifyを使用しようとしていて、保存に問題があります。gulp watchifyに変更を含めるには2回の保存が必要
すべての変更のようですが、出力に変更を適用するために2回保存する必要があります。
jsファイルにコードを追加すると、新しく追加されたコードは、タスクが2回実行された場合にのみ表示されます。
"観る" のための私のコードmainScrpitsタスク
var customOpts = {
entries: ['./app/app.js'],
debug: true
};
var opts = assign({}, watchify.args, customOpts);
var b = watchify(browserify(opts));
gulp.task('mainScripts', bundle);
b.on('update', bundle);
b.on('log', gutil.log);
function bundle() {
console.log('bundle');
return b.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('main.js'))
.pipe(buffer())
.pipe(gulpif(!condition, sourcemaps.init({
loadMaps: true
})))
.pipe(gulpif(!condition, sourcemaps.write('./')))
.pipe(gulp.dest('./dist/js/'))
.pipe(gulpif(isLocal(), connect.reload()));
}
はどちらもwatchifyとgulp.watchがあなたのファイルにその変更を探している
gulp.task('watch', function() {
gulp.watch('app/**/*.js', ['mainScripts']);
});
:
あなたの時計の仕事は自分のmainScriptsタスクを開始する必要があります! – Joel