Optimize images with global caching and convert of non-transparent png to jpg (on the fly)
- Opmitize images with
pngquant/mozjpeg/svgo(like image-webpack-loader) - Cache results into your OS
tmpfolder
- Convert non-transparent
pngimages intojpg(due up to 7x size reduction)
$ npm install image-optimize-loader --save-devloaders: [
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-optimize'
]
}
]{ // default configuration example
imageOptimizeLoader: {
optimizer: {
covertPngToJpg:true
},
pngquant: {
quality: '65-80',
speed: 4
},
mozjpeg:{
targa: false,
},
svgo: {
plugins:[
{ removeComments: true },
{ sortAttrs: true },
{ minifyStyles: true },
]
}
}