From 6f91323b77d6c2286a286071179ad63c5fb782fc Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 20 Oct 2017 17:42:45 +0200 Subject: [PATCH] minimize css --- server/sonar-web/config/webpack.config.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/config/webpack.config.js b/server/sonar-web/config/webpack.config.js index c5d08949f53..a9478858b5b 100644 --- a/server/sonar-web/config/webpack.config.js +++ b/server/sonar-web/config/webpack.config.js @@ -7,6 +7,10 @@ const eslintFormatter = require('react-dev-utils/eslintFormatter'); const webpack = require('webpack'); const paths = require('./paths'); +const cssMinimizeOptions = { + discardComments: { removeAll: true } +}; + module.exports = ({ production = true, fast = false }) => ({ bail: production, @@ -97,7 +101,10 @@ module.exports = ({ production = true, fast = false }) => ({ test: /\.css$/, use: [ 'style-loader', - 'css-loader', + { + loader: 'css-loader', + options: { minimize: production && !fast && cssMinimizeOptions } + }, { loader: 'postcss-loader', options: { @@ -113,7 +120,7 @@ module.exports = ({ production = true, fast = false }) => ({ use: [ { loader: 'css-loader', - options: { url: false } + options: { url: false, minimize: production && !fast && cssMinimizeOptions } }, { loader: 'postcss-loader', -- 2.39.5