Style engine: output global styles CSS rules using selectors#40955
Closed
ramonjd wants to merge 7 commits into
Closed
Style engine: output global styles CSS rules using selectors#40955ramonjd wants to merge 7 commits into
ramonjd wants to merge 7 commits into
Conversation
ramonjd
commented
May 10, 2022
This was referenced May 14, 2022
b9c6d4f to
f5d4eba
Compare
ramonjd
commented
Jun 2, 2022
| 'selector' => $selector, | ||
| 'prettify' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG, | ||
| ) | ||
| ); |
Member
Author
There was a problem hiding this comment.
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
ramonjd
commented
Jun 22, 2022
| @@ -1,11 +1,357 @@ | |||
| { | |||
| "version": 2, | |||
| "customTemplates": [ | |||
Member
Author
There was a problem hiding this comment.
Temporary, in order to test global styles output.
I'll revert.
e07649b to
0e16df9
Compare
ramonjd
commented
Jul 3, 2022
| $block_styles, | ||
| array( | ||
| 'selector' => $selector, | ||
| 'custom_metadata' => array( |
ramonjd
commented
Jul 3, 2022
| * Used to bypass safecss_filter_attr(). | ||
| */ | ||
| const VALID_CUSTOM_PROPERTIES = array( | ||
| '--wp--style--block-gap' => array( 'spacing', 'blockGap' ), |
Member
Author
There was a problem hiding this comment.
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
Member
Author
|
closing in favour of #42143 |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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