Skip to content

Releases: Klathmon/imagemin-webpack-plugin

v2.0.0

29 Jan 22:30
f6db4e4
Compare
Choose a tag to compare

imagemin-webpack-plugin now uses the context option from webpack to work from for all file paths, and includes it's own context that will be joined with the webpack context for any external images.

This is a breaking change for anyone that relied on the old way of using externalImages. It will now respect the context option, and may break the configs for many people.

If you don't use the externalImages option, this release should be safe to upgrade to without any changes.

Full Changelog:

  • Fixed a bug where the plugin would read images from disk twice (thanks @eamodio)
  • Added the context option to externalImages and have it respect the context.

For convenience, here is the major change to the externalImages option:

options.externalImages

type: Object
default: { context: '.', sources: [], destination: null }

Include any external images (those not included in webpack's compilation assets) that you want to be parsed by imagemin.
If a destination value is not supplied the files are optimized in place. You can optionally set either of these to a function which will be invoked at the last possible second before optimization to grab files that might not exist at the time of writing the config (see #37 for more info).

The paths will work based on the webpack's (and this plugin's) context option, so in the following example, the files will be read from ./src/images/**/*.png and will be written to .src/public/images/**/*.png Context only applies to the sources array.

Example:

import ImageminPlugin from 'imagemin-webpack-plugin'
import glob from 'glob'

module.exports = {
  plugins: [
    new ImageminPlugin({
      externalImages: {
        context: 'src', // Important! This tells the plugin where to "base" the paths at
        sources: glob.sync('src/images/**/*.png'),
        destination: 'src/public/images'
      }
    })
  ]
}

V2.0.0-0 Beta

29 Jan 17:22
317cbe4
Compare
Choose a tag to compare
V2.0.0-0 Beta Pre-release
Pre-release

imagemin-webpack-plugin now uses the context option from webpack to work from for all file paths, and includes it's own context that will be joined with the webpack context for any external images.

This is a breaking change for anyone that relied on the old way of using externalImages. It will now respect the context option, and may break the configs for many people.

If you don't use the externalImages option, this release should be safe to upgrade to without any changes.

Full Changelog:

  • Fixed a bug where the plugin would read images from disk twice (thanks @eamodio)
  • Added the context option to externalImages and have it respect the context.

For convenience, here is the major change to the externalImages option:

options.externalImages

type: Object
default: { context: '.', sources: [], destination: null }

Include any external images (those not included in webpack's compilation assets) that you want to be parsed by imagemin.
If a destination value is not supplied the files are optimized in place. You can optionally set either of these to a function which will be invoked at the last possible second before optimization to grab files that might not exist at the time of writing the config (see #37 for more info).

The paths will work based on the webpack's (and this plugin's) context option, so in the following example, the files will be read from ./src/images/**/*.png and will be written to .src/public/images/**/*.png Context only applies to the sources array.

Example:

import ImageminPlugin from 'imagemin-webpack-plugin'
import glob from 'glob'

module.exports = {
  plugins: [
    new ImageminPlugin({
      externalImages: {
        context: 'src', // Important! This tells the plugin where to "base" the paths at
        sources: glob.sync('src/images/**/*.png'),
        destination: 'src/public/images'
      }
    })
  ]
}

V1.6.1

15 Jan 16:43
683fbe4
Compare
Choose a tag to compare

Fixes a bug where setting the test option would cause all files to be skipped!

V1.6.0

14 Jan 16:38
616fc22
Compare
Choose a tag to compare

New features:

  • added a cacheFolder option which will cache any optimized images between runs of webpack. Not enabled by default.

Other changes:

  • Significant refactoring of the plugin. Split into multiple files and functions to make it easier to introduce unit tests in the future (which has been a LONG time coming!)
  • Optimized how the concurrency works, so now it should be "optimally concurrent" by the number of CPUs by default (you can always change this with the maxConcurrency option)
  • Added the ability to use a function in the test option for a lot of customizability with which files the plugin runs on.

V1.6.0-beta.1

14 Dec 18:03
Compare
Choose a tag to compare
V1.6.0-beta.1 Pre-release
Pre-release

New features:

  • added a cacheFolder option which will cache any optimized images between runs of webpack. Not enabled by default.

Other changes:

  • Significant refactoring of the plugin. Split into multiple files and functions to make it easier to introduce unit tests in the future (which has been a LONG time coming!)
  • Optimized how the concurrency works, so now it should be "optimally concurrent" by the number of CPUs by default (you can always change this with the maxConcurrency option)

V1.5.2

08 Sep 18:15
ca8aaa9
Compare
Choose a tag to compare

Small fix to relax version requirements in the package.json thanks to @modosc

v1.5.1

01 Sep 11:59
287b974
Compare
Choose a tag to compare

Added minFileSize and maxFileSize options

V1.5.0

01 Sep 11:20
129613d
Compare
Choose a tag to compare

Changes of note:

  • ExternalImages option added
  • Internal rewrite to clean up the code and improve speed a bit
  • Allow ExternalImages option to be thunked

1.5.0-beta.0

30 Jun 00:26
22d8a37
Compare
Choose a tag to compare
1.5.0-beta.0 Pre-release
Pre-release

Beta release which includes #30 changes.

v1.4.3

22 Nov 16:09
Compare
Choose a tag to compare

No user-facing changes, just some internal changes to how the library is compiled and some speedups.