Commit 64a22c56 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch...

Merge branch '32992-consider-using-zopfli-over-standard-gzip-compression-for-webpack-assets' into 'master'

Use zopfli for better asset compression and disable compression in CI

Closes #32992

See merge request !11798
parents e78c6a34 93789659
...@@ -430,6 +430,7 @@ gitlab:assets:compile: ...@@ -430,6 +430,7 @@ gitlab:assets:compile:
USE_DB: "false" USE_DB: "false"
SKIP_STORAGE_VALIDATION: "true" SKIP_STORAGE_VALIDATION: "true"
WEBPACK_REPORT: "true" WEBPACK_REPORT: "true"
NO_COMPRESSION: "true"
script: script:
- yarn install --pure-lockfile --production --cache-folder .yarn-cache - yarn install --pure-lockfile --production --cache-folder .yarn-cache
- bundle exec rake gitlab:assets:compile - bundle exec rake gitlab:assets:compile
......
---
title: Use zopfli compression for frontend assets
merge_request: 11798
author:
...@@ -16,6 +16,7 @@ var DEV_SERVER_HOST = process.env.DEV_SERVER_HOST || 'localhost'; ...@@ -16,6 +16,7 @@ var DEV_SERVER_HOST = process.env.DEV_SERVER_HOST || 'localhost';
var DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808; var DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808;
var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false'; var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false';
var WEBPACK_REPORT = process.env.WEBPACK_REPORT; var WEBPACK_REPORT = process.env.WEBPACK_REPORT;
var NO_COMPRESSION = process.env.NO_COMPRESSION;
var config = { var config = {
// because sqljs requires fs. // because sqljs requires fs.
...@@ -221,11 +222,18 @@ if (IS_PRODUCTION) { ...@@ -221,11 +222,18 @@ if (IS_PRODUCTION) {
}), }),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify('production') } 'process.env': { NODE_ENV: JSON.stringify('production') }
}),
new CompressionPlugin({
asset: '[path].gz[query]',
}) })
); );
// zopfli requires a lot of compute time and is disabled in CI
if (!NO_COMPRESSION) {
config.plugins.push(
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'zopfli',
})
);
}
} }
if (IS_DEV_SERVER) { if (IS_DEV_SERVER) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment