新人求教关于gulp的问题
发布于 10 年前 作者 bigbig-orange 3580 次浏览 最后一次编辑是 8 年前

最近在用gulp构建前端代码,遇到一个问题 gulp.task(‘imagemin’, function () { gulp.src(’./static/*/img/’) .pipe(imagemin({ progressive: true })) .pipe(gulp.dest(’./dist/image’)) .pipe(notify({ message: ‘Images task complete’ })); }); 这样我每压缩一张图片就会给出一个提示,我想让图片全部压缩完成之后给一个通知就行 请问应该如何做到?

4 回复

https://github.com/mikaelbr/gulp-notify 看文档呀

options.onLast

Type: Boolean Default: false
If the notification should only happen on the last file of the stream. Per default a notification is triggered on each file.

.pipe(notify({ message: ‘Images task complete’ }));这个造成的。

谢谢,成功了我以为是通过gulp的api控制呢给notify自身的忽略了

嗯,知道是这一句,楼上是答案了,也谢谢你

回到顶部