求助: gulp 检测js文件变化,自动执行js文件中的console.log
发布于 7 年前 作者 sblig 2635 次浏览 来自 问答

如题: 不知道用哪个插件可以实现

3 回复

热加载?

test.js function* idMaker(){ var index = 0; while(index<3){ yield index++; } } var gen = idMaker(); console.log(gen.next().value); console.log(gen.next().value); console.log(gen.next().value); console.log(gen.next().value);

当保存文件的时候,控制台能自动打印出来

目前的 gulpfile.js

var gulp = require(‘gulp’), cache = require(‘gulp-cached’), jshint = require(‘gulp-jshint’);

gulp.task(‘jshint’, function () { gulp.src(‘js/*/.js’) .pipe(cache(‘jshint’)) .pipe(jshint({esnext:true})) // Support for es6 .pipe(jshint.reporter(‘default’)); });

gulp.task(‘watch’, function () { gulp.watch(‘js/*/.js’, [‘jshint’]); }); gulp.task(‘default’, [‘jshint’, ‘watch’]);

@luckbb 问题添加了描述,请查阅

回到顶部