作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在尝试使用 imagemin 时收到奇怪的警告,但没有任何反应。
grunt imagemin:primary
Warning: Cannot call method 'replace' of undefined Used --force, continuing.
Done, but with warnings.
给我错误的任务如下
grunt.config 'imagemin'
primary:
options:
optimizationLevel: 7
expand: true
cwd: "assets"
src: "{img,img_two}/**/*.{jpg,jpeg,gif,png}"
dest: "public/compiled/img"
grunt.loadNpmTasks 'grunt-contrib-imagemin'
这些都行不通
src: "img/**/*.{jpg,jpeg,gif,png}"
src: "{img,img_two}/**/*.{jpg,jpeg,gif,png}"
这些工作
src: "img/**/*.jpg"
src: "{img,img_two}/**/*.jpg"
所以它似乎不喜欢多扩展语法,但为什么,它甚至是如何在示例中完成的?
更新:似乎只有 PNG 不起作用,无论我是自己进行扩展还是在组匹配中进行扩展。我在 Windows 8 上,NPM 1.4.3
https://github.com/gruntjs/grunt-contrib-imagemin/issues/219
最佳答案
有同样的问题,我通过删除位于 node_modules 中的 grunt-contrib-imagemin 目录修复了它
然后我运行“npm install grunt-contrib-imagemin”来获取最新版本。
关于node.js - grunt-contrig-imagemin 警告 : Cannot call method 'replace' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23705680/
我在尝试使用 imagemin 时收到奇怪的警告,但没有任何反应。 grunt imagemin:primary Warning: Cannot call method 'replace' of un
我是一名优秀的程序员,十分优秀!