diff options
author | silverwind <me@silverwind.io> | 2023-07-07 20:28:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-07 18:28:48 +0000 |
commit | 811fc9d49c7f2ef128780d9b1a8dac31831f1f7b (patch) | |
tree | 0d51ec899026deb2acb6a131c709acae755b60f3 /webpack.config.js | |
parent | 3780795b938c8915736d73c416e2a8198920c3de (diff) | |
download | gitea-811fc9d49c7f2ef128780d9b1a8dac31831f1f7b.tar.gz gitea-811fc9d49c7f2ef128780d9b1a8dac31831f1f7b.zip |
Minify CSS with Lightning CSS (#25754)
Replace esbuild's rudimentary CSS minifier with [Lightning
CSS](https://github.com/parcel-bundler/lightningcss), which results in
around 4% smaller CSS bundle size, index.css goes from 608K to 584K.
The module is quite new but has active use in the Parcel bundler, and as
of yesterday is also under experimental support in Vite, so I trust it
that bugs will be sorted out quickly.
Before: `assets by path css/*.css 959 KiB`
After: `assets by path css/*.css 933 KiB`
I did give this a cursory test and everything seems to be in order.
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/webpack.config.js b/webpack.config.js index 6070dae247..4dab5cfbae 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,6 +11,7 @@ import webpack from 'webpack'; import {fileURLToPath} from 'node:url'; import {readFileSync} from 'node:fs'; import {env} from 'node:process'; +import {LightningCssMinifyPlugin} from 'lightningcss-loader'; const {EsbuildPlugin} = EsBuildLoader; const {SourceMapDevToolPlugin, DefinePlugin} = webpack; @@ -96,9 +97,10 @@ export default { new EsbuildPlugin({ target: 'es2015', minify: true, - css: true, + css: false, legalComments: 'none', }), + new LightningCssMinifyPlugin(), ], splitChunks: { chunks: 'async', |