webpack-image-minimizer-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

webpack-image-minimizer-plugin

The Webpack plugin for almost quality-lossless compression of images.

NPM JavaScript Style Guide

Description

A few simple lines of code can help you reduce the size of your image file by 70% without changing the quality of the image.

Install

npm install --save-dev webpack-image-minimizer-plugin

Usage

add following codes into your "webpack.config.js" file

const webpackImageMinimizerPlugin = require('webpack-image-minimizer-plugin');

module.exports = {
...
 plugins: [
  ...
  new webpackImageMinimizerPlugin()
  ]
}

Customizition

WebpackImageMinimizerPlugin Constructor accept following options:

{
  // Set if cache file in node_modules/.cache/webpack-image-compress-plugin
  // If you want use new options to compress image, you should clear that folder.
  // so if the asset is not modified, it will use the cached compressed image file.
  enableCache: true, 
  pngQuantOptions: { }, // https://github.com/imagemin/imagemin-pngquant
  mozjpegOptions: { quality: 80 }, // https://github.com/imagemin/imagemin-mozjpeg
  // see 
  // build log.
  showDetailLog: true;
}

This plugin based on image-min, imagemin-pngquant, imagemin-mozjpeg. For more customization, please refer to them.

Package Sidebar

Install

npm i webpack-image-minimizer-plugin

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

31.5 kB

Total Files

11

Last publish

Collaborators

  • easyreactuse