Mozjpeg imagemin example
Closed this issue · 4 comments
Hi,
can someone upload an example how to use Mozjpeg in nuxt.config.js?
Thank you
Hi @sowinski! Thanks for firing an issue.
We use https://www.npmjs.com/package/imagemin-webpack-plugin internally.
nuxt-imagemin
is in fact a thin wrapper over it.
So, you should consult their docs about this topic.
Feel free to reopen if you find that something is not working well.
Cheers!
Hi @sobolevn
It is not working for me.
Thats what I did
npm install imagemin-mozjpeg --save
nuxt.config.js
import imageminMozjpeg from 'imagemin-mozjpeg'
module.exports = {
....
modules: [
... some other modules
['nuxt-imagemin',
{
imageminMozjpeg: { quality: 10, progressive: true }
}]
],
....
}
If I run npm run generate the images are not smaller.
EDIT:
If I just load the "nuxt-imagemin" module. My image folder shrinks from 1,6MB to 1,3MB.
Adding imageminMozjpeg as described above is not changing anything.
@sowinski your configuration is wrong.
see https://www.npmjs.com/package/imagemin-webpack-plugin#optionsplugins
nuxt.config.js
import imageminMozjpeg from 'imagemin-mozjpeg'
module.exports = {
....
modules: [
['nuxt-imagemin', {
plugins: [
imageminMozjpeg({
quality: 100,
progressive: true
})
]
}]
]
...
}
@ricardogobbosouza thanks!