@nuxtjs/imagemin
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@nuxtjs/imagemin

npm version npm downloads Github Actions CI Codecov License

Automatically optimize (compress) all images used in Nuxt.js

📖 Release Notes

Setup

  1. Add @nuxtjs/imagemin dependency to your project
yarn add --dev @nuxtjs/imagemin # or npm install --save-dev @nuxtjs/imagemin
  1. Add @nuxtjs/imagemin to the buildModules section of nuxt.config.js
export default {
  buildModules: [
    // Simple usage
    '@nuxtjs/imagemin',

    // With options
    ['@nuxtjs/imagemin', { /* module options */ }]
  ]
}

⚠️ 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

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using npm run dev

License

MIT License

Copyright (c) Nuxt Community

Readme

Keywords

none

Package Sidebar

Install

npm i @nuxtjs/imagemin

Weekly Downloads

152

Version

1.0.1

License

MIT

Unpacked Size

9.89 kB

Total Files

6

Last publish

Collaborators

  • ricardogobbosouza