1.0.1 • Published 7 years ago

pngmin-webpack-plugin v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Imagemin plugin for Webpack

npm js-standard-style npm donate

This is a simple plugin that uses Pngmin to compress PNG in your project.

Install

npm install pngmin-webpack-plugin

Requires node >=4.0.0

Example Usage

var PngminPlugin = require('pngmin-webpack-plugin').default
// Or if using ES2015:
// import PngminPlugin from 'pngmin-webpack-plugin'

module.exports = {
  plugins: [
    // Make sure that the plugin is after any plugins that add images
    new PngminPlugin({
      pngquant: {
        quality: '95-100'
      }
    })
  ]
}

Working with copy-webpack-plugin:

module.exports = {
  plugins: [
    // Copy the images folder and optimize all the images
    new CopyWebpackPlugin([{
      from: 'images/'
    }]),
    new PngminPlugin({
      pngquant: {
        quality: '95-100'
      }
    })
  ]
}

Contributing

The code is written in ES6 using Javascript Standard Style. Feel free to make PRs adding features you want, but please try to follow Standard. Also, codumentation/readme PRs are more then welcome!

License

MIT Copyright (c) Gregory Benner