-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Style engine: output global styles CSS rules using selectors #40955
Conversation
b9c6d4f
to
f5d4eba
Compare
'selector' => $selector, | ||
'prettify' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG, | ||
) | ||
); |
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.
If the style engine can support/accepted computing/computed preset vars and theme vars it might be able to replace static::to_ruleset( $selector, $declarations )
567978a
to
af4a9ff
Compare
d90553f
to
754d127
Compare
@@ -1,11 +1,357 @@ | |||
{ | |||
"version": 2, | |||
"customTemplates": [ |
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.
Temporary, in order to test global styles output.
I'll revert.
e07649b
to
0e16df9
Compare
$block_styles, | ||
array( | ||
'selector' => $selector, | ||
'custom_metadata' => array( |
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.
Taking some inspiration from #41965
* Used to bypass safecss_filter_attr(). | ||
*/ | ||
const VALID_CUSTOM_PROPERTIES = array( | ||
'--wp--style--block-gap' => array( 'spacing', 'blockGap' ), |
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.
We have to do this because safecss_filter_attr
(kses.php) doesn't allow CSS custom properties.
ac98cd3
to
73f3de3
Compare
Migrate get_block_classes to 6.1 Add prettify option Testing rule generation for get_styles_for_block Let the style engine take care of margin: 0 on the body
…r css custom properties.
…ock-gap and gap. Not a great way to tell the style engine to convert a key to a css custom property.. but...
… property keys. Tests Formatting
73f3de3
to
365a6dd
Compare
closing in favour of #42143 |
What?
Testing what, how and where we can output CSS rules using selectors for global styles in the backend.
This PR sends style nodes and a selector to the style engine to return
It works!
It's possible that we can replace
static::to_ruleset()
❗❗❗❗ Note: because there are loads of idiosyncrasies in global styles, we should find a way to implement this iteratively, so we support certain styles/features as they're built.
Alternative
Passing the entire global styles object: #42143
Why?
How?
Testing Instructions
Screenshots or screencast