Skip to content

Commit

Permalink
Optimizes CSS output
Browse files Browse the repository at this point in the history
  • Loading branch information
d13 committed Aug 23, 2022
1 parent 0c1c7f1 commit a16500c
Show file tree
Hide file tree
Showing 4 changed files with 398 additions and 19 deletions.
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
last 2 Electron versions
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11672,6 +11672,8 @@
"copy-webpack-plugin": "11.0.0",
"csp-html-webpack-plugin": "5.1.0",
"css-loader": "6.7.1",
"css-minimizer-webpack-plugin": "^4.0.0",
"cssnano-preset-advanced": "^5.3.8",
"esbuild": "0.15.5",
"esbuild-loader": "2.19.0",
"eslint": "8.22.0",
Expand Down
9 changes: 9 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const path = require('path');
const { validate } = require('schema-utils');
const TerserPlugin = require('terser-webpack-plugin');
const { WebpackError, webpack, optimize } = require('webpack');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports =
Expand Down Expand Up @@ -391,6 +392,14 @@ function getWebviewsConfig(mode, env) {
deleteOriginalAssets: true,
generator: [imageGeneratorConfig],
}),
new CssMinimizerPlugin({
minimizerOptions: {
preset: [
'cssnano-preset-advanced',
{ discardUnused: false, mergeIdents: false, reduceIdents: false },
],
},
}),
],
},
module: {
Expand Down
Loading

0 comments on commit a16500c

Please sign in to comment.