Releases: Klathmon/imagemin-webpack-plugin
v2.0.0
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 toexternalImages
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
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 toexternalImages
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
V1.6.0
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
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
v1.5.1
V1.5.0
1.5.0-beta.0
Beta release which includes #30 changes.