I'm a new Gulp student, and I made this watch
so if my javascripts files change, it runs build-js
. But when I run Gulp, it compiles everything right but it keeps running build-js
in an infinite loop. What did I do wrong?
Thank you!
gulp.task('build-js', function (cb) {
pump([
gulp.src('lib/*.js'),
uglify(),
gulp.dest('dist')
],
cb
);
});
gulp.task('watch-js', function () {
gulp.watch('lib/*.js', ['build-js']);
})
gulp.task('default', ['build-js', 'watch-js']);