-
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
Open up theme.json processing #22520
Conversation
Size Change: 0 B Total Size: 1.12 MB ℹ️ View Unchanged
|
@@ -559,8 +542,6 @@ function gutenberg_experimental_global_styles_register_cpt() { | |||
register_post_type( 'wp_global_styles', $args ); | |||
} | |||
|
|||
if ( gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing' ) ) { |
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.
Should we just replace the wrapping with gutenberg_experimental_global_styles_has_theme_json_support instead?
Would that be different?
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 wish we could, but the function we use to locate the file (locate_template
) requires some of the WordPress constants to be loaded so it knows where to look for the file.
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 didn't test tbh but what can go wrong :P
Since #22520 was merged on May we've been enqueuing the presets as CSS variables whether or not the theme had support for theme.json as a way to speed up themes using them and get feedback. There are enough checks in place that this is inocuous.
Since #22520 was merged on May we've been enqueuing the presets as CSS variables whether or not the theme had support for theme.json as a way to speed up themes using them and get feedback. There are enough checks in place that this is inocuous.
This PR removes the previous conditions required for
experimental-theme.json
to be processed, open it up to the front-end as well as all block editors (post, site, widgets). Previously we checked whether 1) the FSE experiment was enabled and 2) the editor was the site editor.Testing Instructions
Test that it doesn't load if the theme doesn't provide an
experimental-theme.json
file:#global-styles-inline-css
.--wp--preset
. The expected result is that you don't find any CSS Custom Property.Test that it loads if the theme provides an
experimental-theme.json
file:experimental-theme.json
within the theme directory. Let it be empty.#global-styles-inline-css
.--wp--preset
. The expected result is that the same CSS Custom Properties you can find in the front-end should be present.