简体   繁体   English

Grint imagemin正在运行,但不会缩小

[英]Grunt imagemin running but not minifying

Image-min is running normally but i get 0 images minified why? Image-min正常运行,但是我缩小了0张图像,为什么?

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: 我的咕unt声imagemin部分:

//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'
                        }]

                };  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM