Answer the question
In order to leave comments, you need to log in
Why is imagemin-pngquant not giving a result?
Good afternoon!
I use gulp-imagemin to compress images. As everywhere it is recommended, I put imagemin-pngquant in addition to it. But this image did not shrink better. I don't understand what's the matter.
Connecting libraries:
var gulp = require('gulp'), //подключаем gulp
...
imagemin = require('gulp-imagemin'), // Подключаем библиотеку для работы с изображениями
pngquant = require('imagemin-pngquant'); // Подключаем библиотеку для работы с png
gulp.task('imgmin', function() {
return gulp.src('src/img/**/*')
.pipe(imagemin({
interlaced: true,
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('dist/img'));
});
Answer the question
In order to leave comments, you need to log in
Better late than never))
Use the imagemin([plugins], [options]) construct, and specify the options specifically for each plugin.
For example:
gulp.task('images', function() {
return gulp.src(src.images)
.pipe(imageMin([
pngquant(),
mozjpeg({
progressive: true
})
],{
verbose: true
}))
.pipe(gulp.dest(outputDir + 'img'))
.pipe(connect.reload())
});
Here is an example:
var gulp = require('gulp'),
imageMin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant');
gulp.task('images', function() {
return gulp.src(src.images)
.pipe(imageMin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()],
interlaced: true
}))
.pipe(gulp.dest(outputDir + 'img'))
.pipe(connect.reload())
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question