Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts: Webpack config update to minimize CSS #33676

Merged
merged 3 commits into from
Jul 28, 2021

Conversation

christianztamayo
Copy link
Contributor

Description

The previous configuration does not have CSS minification included aside from the sass-loader built-in which only affects SCSS files. (Closes #33643, Related: #29624)

How has this been tested?

Types of changes

Added the optimize-css-assets-webpack-plugin to the minimizer config.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • [-] My code follows the accessibility standards.
  • [-] I've tested my changes with keyboard and screen readers.
  • [-] My code has proper inline documentation.
  • [-] I've included developer documentation if appropriate.
  • [-] I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jul 25, 2021
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @christianztamayo! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

packages/scripts/package.json Outdated Show resolved Hide resolved
@gziolo gziolo added [Package] Scripts /packages/scripts [Type] Enhancement A suggestion for improvement. labels Jul 27, 2021
christianztamayo and others added 2 commits July 27, 2021 23:20
Adds the optimize-css-assets-webpack-plugin to the minimizer config
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this PR and it works as advertised. Thank you for the improvement 👍🏻

@gziolo gziolo merged commit 21e78ef into WordPress:trunk Jul 28, 2021
@github-actions
Copy link

Congratulations on your first merged pull request, @christianztamayo! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 11.3 milestone Jul 28, 2021
@ocean90
Copy link
Member

ocean90 commented Jul 28, 2021

@gziolo This should probably be released as a breaking change because it can impact users which have their own PostCSS config which already includes cssnano (which optimize-css-assets-webpack-plugin uses by default) with a custom config for allowed optimisations.

Since sass-loader seems to minify the CSS already, should we maybe extend the default PostCSS config to use cssnano instead?

Related:

@gziolo
Copy link
Member

gziolo commented Jul 28, 2021

@ocean90, if we can avoid all the hassle by extending the default PostCSS config then it would be the best solution. Let's explore that approach. We have some time (2 weeks) because the new Gutenberg plugin was cut before I merged these changes 😄

@gziolo
Copy link
Member

gziolo commented Jul 29, 2021

I opened a follow-up: #33750.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scripts: The build command does not minify CSS files
4 participants