-
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
Global Styles: Alternative method for enqueueing custom CSS #47554
Global Styles: Alternative method for enqueueing custom CSS #47554
Conversation
ded874c
to
4e4f9db
Compare
4e4f9db
to
0f82606
Compare
Flaky tests detected in d552d79. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4053536069
|
@@ -77,7 +77,7 @@ function gutenberg_get_global_styles_custom_css() { | |||
} | |||
|
|||
if ( ! wp_theme_has_theme_json() ) { | |||
return; | |||
return ''; |
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.
Need to return empty string here.
This tested well for me. The only thing I noticed is that with using A comment was also made here about trying to keep the custom CSS loading in the same location as the customizer CSS - I don't have a strong opinion one way or the other on how critical this is - use of the |
Using Let's keep using cc @aristath |
Sounds good to me 👍 |
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.
LGTM! 👍
What?
My alternative to the enqueueing method is proposed at #47396.
Instead of using two separate callbacks for loading custom CSS from Customizer and Site Editor, the new method removes Customzer callback, combines custom CSS values, and enqueues styles after
global-styles
.I've also made the following changes to the
get_global_styles_custom_css
method:$types
variable - the function doesn't accept arguments.::get_merged_data
if a theme does not have atheme.json
file.Testing Instructions
Please take a look at the instructions in the original PR.