-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
🚧 WIP: Use the style engine in global-styles 🚧 🧪 #48955
base: trunk
Are you sure you want to change the base?
Conversation
Flaky tests detected in 11536da. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4445506352
|
@ramonjd @andrewserong Continuing the work we started last year with the Style Engine, we should try to implement it in global-styles, block-styles etc. |
Thanks for picking up this work again @aristath! I'll start having a look at this over the next week. |
af7feb3
to
f01ca92
Compare
Very cool @aristath! A few first impressions:
Great work so far! Thanks for diving in the deep end with all this exploration 🙂 |
Sorry for the loooong delay in getting back to you on this. I'm still adjusting to being back behind a keyboard. Thanks a lot for diving in here. I'm loving the direction. Adding the global styles to a store will open up a lot of possibilities, e.g., it is very pleasing to see prettified and consolidated output in the Also I'm excited to see that Chrome will support CSS nesting, having global styles available in the store will (I hope) allow us to better control specificity and more easily avoid CSS override issues. That's a while off yet, but it's something I'm really keen on. Can't you tell? 😆
I agree in principle here — the Theme JSON class is massive and adding replacement classes would increase the already high cognitive load — but am wondering how it would work in practice. Marking the replaced methods as deprecated, which is what this PR does, would help even though it is a longer term strategy. If we abstract, I think the style engine should be ignorant of its implementation in WP_Theme_JSON as much as possible, so maybe there's scope for a new Gutenberg class (not part of style engine) to which we can migrate specific global styles functionality and integrate the style engine, e.g., WP_Global_Styles or whatever. That class could act as an adapter/facade and eventually take over all global styles responsibility, e.g., subsume the logic in I'm just rambling here by the way.
I noted this on the relevant issue. #46563 There's also the potential to remove the need for |
It's very hard to read the code to try to understand what's happening here. I would love if we could write some documentation/schemas to explain the goal and the architecture here. |
What?
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast