After seeing the following graph [here](http://sweetme.at/2013/09/11/how-to-maximize-png-image-compression-with-optipng/) we decided to test optimsation level 2 for OptiPNG instead of 7. This is because, acording to the graph we would notice no real difference in avarage file size but would notice a speed increase with our builds.  After testing , we noticed our theme build go from a build time of over 10 mins (just on the 94% asset optimisation step) to an avarage of `150.75s`. All the while, we only gained 10-15kb per png file which we believe more than reasonable for a build speed increase of this magnatude.
36 lines
895 B
JavaScript
36 lines
895 B
JavaScript
'use strict'; // eslint-disable-line
|
|
|
|
const { default: ImageminPlugin } = require('imagemin-webpack-plugin');
|
|
const imageminMozjpeg = require('imagemin-mozjpeg');
|
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
|
|
|
const config = require('./config');
|
|
|
|
module.exports = {
|
|
plugins: [
|
|
new ImageminPlugin({
|
|
optipng: { optimizationLevel: 2 },
|
|
gifsicle: { optimizationLevel: 3 },
|
|
pngquant: { quality: '65-90', speed: 4 },
|
|
svgo: {
|
|
plugins: [
|
|
{ removeUnknownsAndDefaults: false },
|
|
{ cleanupIDs: false },
|
|
{ removeViewBox: false },
|
|
],
|
|
},
|
|
plugins: [imageminMozjpeg({ quality: 75 })],
|
|
disable: (config.enabled.watcher),
|
|
}),
|
|
new UglifyJsPlugin({
|
|
uglifyOptions: {
|
|
ecma: 5,
|
|
compress: {
|
|
warnings: true,
|
|
drop_console: true,
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
};
|