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

Import CSS files before optimization #61121

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

benoitchantre
Copy link
Contributor

What?

Import CSS files before the minification process.

Closes #61112.

Why?

Small performance improvement for people using CSS imports and the @wordpress/scripts package.

How?

postcss-import is run before cssnano

Testing Instructions

  1. Scaffold a block
  2. Rename your main stylesheet from .scss to .css
  3. Create 2 CSS files
  4. Import these files in the main stylesheet
  5. Run npm run build
  6. See that you have a resulting stylesheet that is minified (only one line instead of two)

Testing Instructions for Keyboard

Screenshots or screencast

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: benoitchantre <benoitchantre@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@gziolo gziolo added [Package] Scripts /packages/scripts [Type] Enhancement A suggestion for improvement. labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wp-scripts: minification of CSS imports is done too early in the process
2 participants