T
T
Tatyana2020-01-18 23:46:43
Node.js
Tatyana, 2020-01-18 23:46:43

Why is the pegtran utility of the imagemin plugin throwing an error?

When building, gulp throws an error: TypeError: $.gp.imagemin.jpegtran is not a function
What could it be and how to fix it?
module.exports = function () {
$.gulp.task('images', function () {
return $.gulp.src('build/img/**/*.{png,jpg,svg}')
.pipe ($.gp.imagemin([
$.gp.imagemin.jpegtran({progressive: true}),
$.imageminJpegRecompress({
loops: 5,
min: 65,
max: 70,
quality: 'medium'
}),
$. gp.imagemin.optipng({optimizationLevel: 3}),
$.pngquant({quality: '65-70', speed: 5}),
$.gp.imagemin.svgo()
]))
.pipe($.gulp.dest('build/img'));
});
};

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Larisa, 2020-01-20
@webkoshechka

Because in this version jpegtran is replaced by mozjpeg, respectively, it needs to be written in the code: and everything will start) https://github.com/sindresorhus/gulp-imagemin$.gp.imagemin.mozjpeg({ progressive: true }),

Y
Yugo777, 2020-11-15
@Yugo777

And $.pngquant({quality: '65-70', speed: 5}), should be replaced with $.pngquant({ quality: [0.65, 0.70], speed: 5 }),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question