Grunt imagemin正在运行但没有缩小 [英] Grunt imagemin running but not minifying
本文介绍了Grunt imagemin正在运行但没有缩小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的终端上运行代码后:
$ grunt imagemin
运行imagemin:dist(imagemin)任务
缩小的0张图片(保存0 B)
完成,没有错误。
我不明白,我尝试加载不同的图片,但仍未压缩。
imagemin part on my grunt:
// Image min ======= ========================
var imagemin;
config.imagemin = imagemin = {};
imagemin.dist = {
options:{
optimizationLevel:5,
progressive:true,
},
dynamic:{
files :[{
expand:true,
cwd:'assets / images',
src:['** / *。{png,jpg,gif}'],
dest:'public / images'
}]
}
};
解决方案
我的问题是:dynamic:{}在那里,在他们的文档中,他们只是解释如何使用动态和静态,但不应该在代码中。它有点混乱,但无论如何我修好了。
没有动态代码{}。
$ b $
//图片分钟===============================
var imagemin ;
config.imagemin = imagemin = {};
imagemin.dist = {
options:{
optimizationLevel:5,
progressive:true,
},
files:[{
展开:true,
cwd:'assets / images',
src:['** / *。{png,jpg,gif}'],
dest:' public / images'
}]
};
Image-min is running normally but i get 0 images minified why?
after run the code on my terminal:
$ grunt imagemin
Running "imagemin:dist" (imagemin) task
Minified 0 images (saved 0 B)
Done, without errors.
I am not understand, I tried loads different images and still not compressing.
imagemin part on my grunt:
//Image min ===============================
var imagemin;
config.imagemin = imagemin = {};
imagemin.dist = {
options: {
optimizationLevel: 5,
progressive: true,
},
dynamic: {
files: [{
expand: true,
cwd: 'assets/images',
src: ['**/*.{png,jpg,gif}'],
dest: 'public/images'
}]
}
};
解决方案
my problem was: dynamic: { }, should not have there, in their documentation they just explain how to use dynamic and static but should not have that in the code. its a bit confuse but anyway I fixed.
code without the dynamic {}.
//Image min ===============================
var imagemin;
config.imagemin = imagemin = {};
imagemin.dist = {
options: {
optimizationLevel: 5,
progressive: true,
},
files: [{
expand: true,
cwd: 'assets/images',
src: ['**/*.{png,jpg,gif}'],
dest: 'public/images'
}]
};
这篇关于Grunt imagemin正在运行但没有缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文