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
Fix stylesheet generation #25293
Fix stylesheet generation #25293
Conversation
Size Change: 0 B Total Size: 1.2 MB ℹ️ View Unchanged
|
I read that and I agree that we'd want to have a more general method. However, I'm a little worried about the performance costs of using a regexp in such a hot path to convert camel to kebab case. I'm a little torn about this, to be honest, and feel some urgency to have a path that can go in Gutenberg 9.0. Would it work for you if we merge this PR as a hotfix and then keep talking about a general approach in yours? This way we already have a fix and don't need to rush #25250 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and confirmed.
Code looks good and makes sense 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and confirmed.
Code looks good and makes sense 👍
Meh sorry about the double-approval... must have clicked the approve button twice.
Agreed, I sat on this one for hours before submitting the other PR. |
* @return string CSS property name. | ||
*/ | ||
function gutenberg_experimental_global_styles_get_css_property( $style_property ) { | ||
switch ( $style_property ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess instead of having a switch we may have an array with the mappings:
array(
'backgroundColor' => ''background-color',
'fontSize' => 'font-size',
...
)
* Fix stylesheet generation * Make linter happy
In #25185 we centralized and modified the support keys to use camelCase instead of kebab-case. By doing so, we introduced a bug by which the stylesheet generation won't be able to determine which properties to output and will only include
color
andbackground
. This PR fixes it.How to test
global-styles-inline-css
inline stylesheet. Verify the CSS propscolor
,font-size
,line-height
,background-color
, and--wp--style--color--link
are present. Previously, onlycolor
andbackground
could be present.