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

wp-scripts: minification of CSS imports is done too early in the process #61112

Closed
benoitchantre opened this issue Apr 25, 2024 · 0 comments · Fixed by #61121
Closed

wp-scripts: minification of CSS imports is done too early in the process #61112

benoitchantre opened this issue Apr 25, 2024 · 0 comments · Fixed by #61121
Assignees
Labels
[Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@benoitchantre
Copy link
Contributor

What problem does this address?

CSS files that are imported are minified, but the minification happens to early.
Each imported file is minified, but there's a line break between each import in the resulting file.

This is an improvement of #56516.

Example:

Content of global.css

@import "_reset.css";
@import "_typography.css";

Result

*,:after,:before{box-sizing:border-box}
:where(h1,h2,.has-large-font-size,.has-x-large-font-size,.has-xx-large-font-size){text-wrap:balance}

Expected result

*,:after,:before{box-sizing:border-box}:where(h1,h2,.has-large-font-size,.has-x-large-font-size,.has-xx-large-font-size){text-wrap:balance}

What is your proposed solution?

Adjust the webpack.config.js to use postcss-import before cssnano

@benoitchantre benoitchantre added the [Type] Enhancement A suggestion for improvement. label Apr 25, 2024
benoitchantre added a commit to benoitchantre/gutenberg that referenced this issue Apr 25, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Apr 25, 2024
benoitchantre added a commit to benoitchantre/gutenberg that referenced this issue Apr 25, 2024
benoitchantre added a commit to benoitchantre/gutenberg that referenced this issue Aug 30, 2024
benoitchantre added a commit to benoitchantre/gutenberg that referenced this issue Aug 30, 2024
@gziolo gziolo closed this as completed in 5a15320 Aug 31, 2024
bph pushed a commit to bph/gutenberg that referenced this issue Aug 31, 2024
* Import CSS files before optimization

Closes WordPress#61112.

* Update changelog

Co-authored-by: benoitchantre <benoitchantre@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant