Search code examples
gulpgulp-imagemin

Gulp image optimizer(gulp-imagemin) not fully optimize


I am using gulp to compile my work, Recently I am using gulp-imagemin plugin to optimize the images, and its working but still not fully optimize.On Google PageSpeed Insights showing the images are not fully optimize.How to fully optimize my images? Please help. This is the function I am using on my gulpfile.js, And it reducing about 2-5% images size.But not fully optimize.

gulp.task('imgs', function () {
    gulp
        .src(paths.assets.images)
        .pipe(imagemin({
            progressive: true,
            interlaced: true,
            pngquant: true
        }))
        .pipe(flatten())
        .pipe(gulp.dest(paths.build + "/img"));
});

Here is the screenshot where Google PageSpeed Insights showing images are not optimize. screenshot


Solution

  • This one working much better..

    gulp.task('imgs', function () {
        gulp
            .src(paths.assets.images)
            .pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true })))
            .pipe(flatten())
            .pipe(gulp.dest(paths.build + "/images"));
    });