Skip to content

Instantly share code, notes, and snippets.

@KartoffelToby
Created August 1, 2019 09:19
Show Gist options
  • Select an option

  • Save KartoffelToby/bb4b8664fa2aebfe19a23741d1d08fd4 to your computer and use it in GitHub Desktop.

Select an option

Save KartoffelToby/bb4b8664fa2aebfe19a23741d1d08fd4 to your computer and use it in GitHub Desktop.
Angular with Brotli
...
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./extend.webpack.config.js"
},
...
const BrotliPlugin = require('brotli-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
module.exports = {
plugins: [
new BrotliPlugin({
asset: '[path].br[query]',
test: /\.(js|css|html|svg|eot|woff2|woff|ttf)$/,
minRatio: 0.8
}),
new CompressionPlugin({
test: /\.(js|css|html|svg|eot|woff2|woff|ttf)$/,
filename: '[path].gz[query]',
algorithm: 'gzip',
minRatio: 0.8
})
]
}
npm i @angular-builders/custom-webpack -D
ng build --prod --aot=true --extractCss=false --optimization=true --build-optimizer=true --output-hashing none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment