Mercurial > hg > thermostat-ng > web-client
changeset 160:e4392e130e4f
Include gzipped assets in build output
Reviewed-by: jerboaa
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-August/024571.html
author | Andrew Azores <aazores@redhat.com> |
---|---|
date | Mon, 21 Aug 2017 09:02:56 -0400 |
parents | 2b1339f22184 |
children | 67492977d9ac |
files | package.json webpack.config.js |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/package.json Thu Aug 17 11:25:06 2017 -0400 +++ b/package.json Mon Aug 21 09:02:56 2017 -0400 @@ -21,6 +21,7 @@ "babel-polyfill": "^6.23.0", "babel-preset-es2015": "^6.24.0", "big.js": "^3.1.3", + "compression-webpack-plugin": "^1.0.0", "css-loader": "^0.28.0", "es6-promise": "^4.1.0", "eslint": "^3.19.0",
--- a/webpack.config.js Thu Aug 17 11:25:06 2017 -0400 +++ b/webpack.config.js Mon Aug 21 09:02:56 2017 -0400 @@ -29,6 +29,7 @@ var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); +var CompressionPlugin = require('compression-webpack-plugin'); var path = require('path'); var ENV = process.env.npm_lifecycle_event; @@ -140,6 +141,16 @@ ); } + config.plugins.push( + new CompressionPlugin({ + asset: '[path].gz[query]', + algorithm: 'gzip', + test: /\.js$/, + threshold: 10240, + minRatio: 0.8 + }) + ); + config.devServer = { host: '0.0.0.0', contentBase: './src/assets',