CNode

求助: gulp 检测js文件变化,自动执行js文件中的console.log

问答
Ssblig发布于9 年前最后回复9 年前3 回复3331 浏览0 收藏

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

查看回复

回复 (3)

L
luckbb#1·9 年前

热加载?

S
sblig#2·9 年前

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']);

S
sblig#3·9 年前

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

参与回复
登录后即可参与回复。登录