Nuxt module to minify your images. Works with: png, jpeg, gif, and svg
Nuxtmodule to minify your images. Works with:
png,
jpeg,
gif, and
svg.
npm install --save nuxt-imagemin yarn add nuxt-imagemin
Add
nuxt-imageminto your
nuxt.config.js:
{ modules: ["nuxt-imagemin"]; }
assetsfolder, for example:
logo.png
nuxtwill minify your image assets
Read more about how assets work.
We use
imageminplugin for
webpackinternally. It has a lot of options. We pass any provided options into the
imageminitself:
{ modules: [ [ "nuxt-imagemin", { optipng: { optimizationLevel: 5 }, gifsicle: { optimizationLevel: 2 } } ] ]; }
If you want to add a custom plugin for
imagemin, you can follow this steps with
imagemin-webpas example.
import imageminWebp from 'imagemin-webp'module.exports = { modules: [ ['nuxt-imagemin', { plugins: [ imageminWebp({quality: 50}) ] }] ] }
MIT.