Skip to content

Commit

Permalink
Scripts: Webpack config update to minimize CSS (#33676)
Browse files Browse the repository at this point in the history
* Webpack config update to minimize CSS

Adds the optimize-css-assets-webpack-plugin to the minimizer config

* Update CHANGELOG.md

* Move OptimizeCssAssetsPlugin from minimizer to plugins

Co-authored-by: Greg Ziółkowski <[email protected]>
christianztamayo and gziolo authored Jul 28, 2021
1 parent 6c1ea65 commit 21e78ef
Showing 4 changed files with 591 additions and 0 deletions.
586 changes: 586 additions & 0 deletions package-lock.json
1 change: 1 addition & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@

- Update `eslint-plugin-markdown` package to `2.20.0` ([#33432](https://github.com/WordPress/gutenberg/pull/33432)).
- Update `sass` package to `1.35.2` ([#33433](https://github.com/WordPress/gutenberg/pull/33433)).
- Update webpack config to minimize also CSS files ([#33676](https://github.com/WordPress/gutenberg/pull/33676)).

## 17.0.0 (2021-07-21)

3 changes: 3 additions & 0 deletions packages/scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
const { BundleAnalyzerPlugin } = require( 'webpack-bundle-analyzer' );
const LiveReloadPlugin = require( 'webpack-livereload-plugin' );
const MiniCSSExtractPlugin = require( 'mini-css-extract-plugin' );
const OptimizeCssAssetsPlugin = require( 'optimize-css-assets-webpack-plugin' );
const TerserPlugin = require( 'terser-webpack-plugin' );
const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' );
const path = require( 'path' );
@@ -228,6 +229,8 @@ const config = {
// obsolete and should be removed. Related webpack issue:
// https://github.com/webpack-contrib/mini-css-extract-plugin/issues/85
new FixStyleWebpackPlugin(),
// OptimizeCssAssetsPlugin to minify CSS
new OptimizeCssAssetsPlugin(),
// WP_LIVE_RELOAD_PORT global variable changes port on which live reload
// works when running watch mode.
! isProduction &&
1 change: 1 addition & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@
"mini-css-extract-plugin": "^1.3.9",
"minimist": "^1.2.0",
"npm-package-json-lint": "^5.0.0",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"postcss": "^8.2.15",
"postcss-loader": "^4.2.0",
"prettier": "npm:wp-prettier@2.2.1-beta-1",

0 comments on commit 21e78ef

Please sign in to comment.