diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-06-04 11:02:30 +0000 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-06-04 11:02:30 +0000 |
commit | 64a22c562814703419a818941d85e2309312ba0c (patch) | |
tree | 24e76ce78893997f68d5d430853d1097ee5b53bd | |
parent | e78c6a340e4cccec406db809886432c48593a660 (diff) | |
parent | 937896599e392896ef6dc16dc24ab847f1dc14fc (diff) | |
download | gitlab-ce-64a22c562814703419a818941d85e2309312ba0c.tar.gz |
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
-rw-r--r-- | .gitlab-ci.yml | 1 | ||||
-rw-r--r-- | changelogs/unreleased/32992-consider-using-zopfli-over-standard-gzip-compression-for-webpack-assets.yml | 4 | ||||
-rw-r--r-- | config/webpack.config.js | 14 |
3 files changed, 16 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dea11bb9f61..b442e48a3d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -430,6 +430,7 @@ gitlab:assets:compile: USE_DB: "false" SKIP_STORAGE_VALIDATION: "true" WEBPACK_REPORT: "true" + NO_COMPRESSION: "true" script: - yarn install --pure-lockfile --production --cache-folder .yarn-cache - bundle exec rake gitlab:assets:compile diff --git a/changelogs/unreleased/32992-consider-using-zopfli-over-standard-gzip-compression-for-webpack-assets.yml b/changelogs/unreleased/32992-consider-using-zopfli-over-standard-gzip-compression-for-webpack-assets.yml new file mode 100644 index 00000000000..93037d6181e --- /dev/null +++ b/changelogs/unreleased/32992-consider-using-zopfli-over-standard-gzip-compression-for-webpack-assets.yml @@ -0,0 +1,4 @@ +--- +title: Use zopfli compression for frontend assets +merge_request: 11798 +author: diff --git a/config/webpack.config.js b/config/webpack.config.js index c99298239b2..61f1eaaacd1 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -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_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false'; var WEBPACK_REPORT = process.env.WEBPACK_REPORT; +var NO_COMPRESSION = process.env.NO_COMPRESSION; var config = { // because sqljs requires fs. @@ -221,11 +222,18 @@ if (IS_PRODUCTION) { }), new webpack.DefinePlugin({ '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) { |