gulp-imageoptim
gulp-imageoptim copied to clipboard
doesn't work with watch
Every time I use gulp watch with ImageOptim, it multiply the length of files by itself. For example:
- 2 new files, it try to minify 4 files;
- 3 new files, it try to minify 9 files;
- 4 new files, it try to minify 16 files;
It only work well with one file per time.
My task:
gulp.watch(['src/images/**/*'], function(event) {
return gulp
.src('./src/images/**/*.{png,gif,jpg}')
.pipe(imageOptim.optimize())
.on('error', function (error) {
console.error(String(error));
})
.pipe(gulp.dest('./dist/img'));
});
Would you find out what it can be?
Thanks!
Thank you for bringing this to my attention. I will look into it.