Skip to content

Commit

Permalink
feat(build-config): add CSS optimizer plugin to minify assets
Browse files Browse the repository at this point in the history
  • Loading branch information
ZauberNerd committed Apr 4, 2018
1 parent ba80b51 commit 236e127
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/build-config/configs/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var webpack = require('webpack');
var StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
var ServiceWorkerPlugin = require('../plugins/service-worker');
var MiniCSSExtractPlugin = require('mini-css-extract-plugin');
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');

var hopsConfig = require('hops-config');

Expand Down Expand Up @@ -55,6 +57,17 @@ module.exports = {
},
},
},
minimizer: [
new UglifyJSPlugin({
cache: true,
parallel: true,
sourceMap: true,
uglifyOptions: {
output: { comments: false },
},
}),
new OptimizeCSSPlugin(),
],
},
plugins: [
new StatsWriterPlugin({ fields: null }),
Expand Down
2 changes: 2 additions & 0 deletions packages/build-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@
"lodash.template": "^4.4.0",
"mini-css-extract-plugin": "^0.3.0",
"mkdirp": "^0.5.1",
"optimize-css-assets-webpack-plugin": "^4.0.0",
"pkg-dir": "^2.0.0",
"postcss": "^6.0.16",
"postcss-cssnext": "^3.0.2",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.10",
"steed": "^1.1.3",
"style-loader": "^0.20.0",
"uglifyjs-webpack-plugin": "^1.2.4",
"url-loader": "^1.0.0",
"webpack": "^4.3.0",
"webpack-node-externals": "^1.6.0",
Expand Down
16 changes: 15 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,7 @@ cssesc@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4"

cssnano@^3.10.0:
cssnano@^3.10.0, cssnano@^3.4.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38"
dependencies:
Expand Down Expand Up @@ -4664,6 +4664,13 @@ kind-of@^6.0.0, kind-of@^6.0.2:
version "6.0.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051"

last-call-webpack-plugin@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz#9742df0e10e3cf46e5c0381c2de90d3a7a2d7555"
dependencies:
lodash "^4.17.5"
webpack-sources "^1.1.0"

lazy-cache@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
Expand Down Expand Up @@ -5550,6 +5557,13 @@ optimist@^0.6.1:
minimist "~0.0.1"
wordwrap "~0.0.2"

optimize-css-assets-webpack-plugin@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-4.0.0.tgz#d5f80041fb1391b358a1f35273c3b53de814e8fe"
dependencies:
cssnano "^3.4.0"
last-call-webpack-plugin "^3.0.0"

optionator@^0.8.1, optionator@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
Expand Down

0 comments on commit 236e127

Please sign in to comment.