@nuxtjs/imagemin
v1.0.1
Published
Automatically optimize (compress) all images used in Nuxt.js
Downloads
836
Readme
@nuxtjs/imagemin
Automatically optimize (compress) all images used in Nuxt.js
Setup
- Add
@nuxtjs/imagemin
dependency to your project
yarn add --dev @nuxtjs/imagemin # or npm install --save-dev @nuxtjs/imagemin
- Add
@nuxtjs/imagemin
to thebuildModules
section ofnuxt.config.js
export default {
buildModules: [
// Simple usage
'@nuxtjs/imagemin',
// With options
['@nuxtjs/imagemin', { /* module options */ }]
]
}
:warning: If you are using Nuxt < v2.9 you have to install the module as a dependency
(No --dev
or --save-dev
flags) and use modules
section in nuxt.config.js
instead of buildModules
.
Using top level options
export default {
buildModules: [
'@nuxtjs/imagemin'
],
imagemin: {
/* module options */
}
}
Options
See image-minimizer-webpack-plugin for the complete list of options available.
enableInDev
- Type:
Boolean
- Default:
false
Images will be minified in development mode, if this option is set to true
.
This could increase the build time.
minimizerOptions
- Type:
Object
- Default:
plugins: [
['gifsicle', { interlaced: true }],
['jpegtran', { progressive: true }],
['optipng', { optimizationLevel: 5 }],
['svgo', { plugins: [{ removeViewBox: false }] }]
]
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
npm run dev
License
Copyright (c) Nuxt Community