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

FSE: inline block styles minification issues with calc() #29518

Closed
Sandstromer opened this issue Mar 3, 2021 · 2 comments · Fixed by #29554
Closed

FSE: inline block styles minification issues with calc() #29518

Sandstromer opened this issue Mar 3, 2021 · 2 comments · Fixed by #29554
Assignees
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@Sandstromer
Copy link

Sandstromer commented Mar 3, 2021

Description

In 10.1 the loading method of block styles on the frontend was changed, see #28358

There is an issue with the minified inline styles, specifically the removal of spacing in calc() functions.
e.g. the columns stylesheet contains flex-basis:calc(50% - 1em)
whereas the minified inline style now renders the same as flex-basis:calc(50%-1em) with the required spacing stripped out, resulting in an invalid value.

WordPress information

  • WordPress version: 5.6.2
  • Gutenberg version: 10.1.0
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes - TT1Blocks
@skorasaurus skorasaurus added the [Type] Regression Related to a regression in the latest release label Mar 4, 2021
@gziolo gziolo added the [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. label Mar 4, 2021
@gziolo
Copy link
Member

gziolo commented Mar 4, 2021

@aristath, any hints on how it could be resolved? Well, I know that one of the following regular expressions need some tweaks:

gutenberg/lib/blocks.php

Lines 293 to 294 in 771a45b

$re1 = '(?sx)("(?:[^"\\\\]++|\\\\.)*+"|\'(?:[^\'\\\\]++|\\\\.)*+\')|/\\* (?> .*? \\*/ )';
$re2 = '(?six)("(?:[^"\\\\]++|\\\\.)*+"|\'(?:[^\'\\\\]++|\\\\.)*+\')|\\s*+ ; \\s*+ ( } ) \\s*+|\\s*+ ( [*$~^|]?+= | [{};,>~+-] | !important\\b ) \\s*+|( [[(:] ) \\s++|\\s++ ( [])] )|\\s++ ( : ) \\s*+(?!(?>[^{}"\']++|"(?:[^"\\\\]++|\\\\.)*+"|\'(?:[^\'\\\\]++|\\\\.)*+\')*+{)|^ \\s++ | \\s++ \\z|(\\s)\\s+';

aristath added a commit that referenced this issue Mar 4, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 4, 2021
@aristath
Copy link
Member

aristath commented Mar 4, 2021

Pushed a fix in #29554, pending review.

aristath added a commit that referenced this issue Mar 8, 2021
* fixes #29518

* Add test for calc()

* cs

* add more tests

* Add test for css-vars/calc combo

* cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants