gruntjs - 在新文件上 Grunt Imagemin

标签 gruntjs grunt-contrib-imagemin

我正在使用 Grunt Imagemin 来优化图像文件夹。但是,每次我运行该命令时,它都会在所有图像上运行 imagemin。有没有办法在检测到新更改时只运行 grunt imagemin?

最佳答案

尝试实现 grunt-newer :

Grunt Task for running tasks if source files are newer only.



在这里您可以找到 short tutorial关于如何使用它。

实现后,您应该在前面加上 newer:到 imagemin 任务。

关于gruntjs - 在新文件上 Grunt Imagemin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23507825/

相关文章:

node.js - 使用 sails 时是否需要在 package.json 中显式 grunt

node.js - 用于 pretty-print HTML 的模块?

javascript - Grunt 未加载

gruntjs - 如何从 grunt-contrib-imagemin 中排除目录

gruntjs - Yeoman Grunt imagemin fatal error : Cannot read property 'contents' of undefined

javascript - 咕噜 imagemin 错误 : Cannot read property 'contents' of undefined

css - 使用 Grunt Compass 任务生成没有调试信息的生产 CSS 代码

node.js - grunt-contrig-imagemin 警告 : Cannot call method 'replace' of undefined

javascript - 如何使用 grunt-contrib-imagemin 的插件无损优化图像?

angularjs - 动态图像 ng-src 不会更改为缩小图像名称