1.0.0 • Published 7 years ago
nuxt-imagemin v1.0.0
nuxt-imagemin
Nuxt module to minify your images.
Works with: png, jpeg, gif, and svg.
Installation
npm install --save nuxt-imageminAdd nuxt-imagemin to your nuxt.config.js:
{
modules: [
'nuxt-imagemin',
]
}Usage
- Put your images inside
assetsfolder, for example:logo.png - Then create an element to render it:
<img src="~/assets/logo.png"> - When you will bundle your app for production,
nuxtwill minify your image assets
Read more about how assets work.
Options
We use imagemin plugin for webpack internally.
It has a lot of options.
We pass any provided options into the imagemin itself:
{
modules: [
['nuxt-imagemin', {
optipng: { optimizationLevel: 5 },
gifsicle: { optimizationLevel: 2 }
},
]
}License
MIT.