E
E
Egor Zhivagin2017-03-27 10:50:18
Web development
Egor Zhivagin, 2017-03-27 10:50:18

How to properly configure imagemin?

I decided to get acquainted with imagemin (I used to use tinypng in the browser, but then the number of images increased dramatically). I was not very satisfied with the default compression level, I decided to raise it. But here everyone contradicts each other:
1 - Docks of imagemin itself:

.pipe(imagemin([
    imagemin.optipng({optimizationLevel: 5}),
]))
Note that you may come across an older, implicit syntax. In versions < 3, the same was written like this:

.pipe(imagemin({
    optimizationLevel: 5,

Okay, well, the console swears at the point here - imagemin.jpegtran Installed
via npm optipng, but it's no use
2 - optipng plugin docks:
const imageminOptipng = require('imagemin-optipng');

imagemin(['images/*.png'], 'build/images', {use: [imageminOptipng()]}).then(() => {
  console.log('Images optimized');
});

It’s clear with the addresses, but where then is the level set up?
In short, I'm confused. The plugin is popular, the answer should be simple, right?) Version 3.2.0

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question