-
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
Block supports: allow overriding prettify options for enqueued CSS #44248
Conversation
…tions to gutenberg_style_engine_get_stylesheet_from_context(). This is so tests and other usages of gutenberg_enqueue_stored_styles() can bypass, or at least don't have to rely on, the global constant `SCRIPT_DEBUG` to determine whether the output is prettified.
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.
Thanks for following up @ramonjd! I really like this approach, makes it easier to test, and also opens up the function to support more options in the future, too.
✅ Tested that by default prettify is still set to off
✅ Tested that by defining SCRIPT_DEBUG
as true
in wp-config.php
the prettified output is switched on as before
✅ Manually updated tests to set prettify
to true
to confirm that it correctly fails the updated tests
LGTM! ✨
…tions to gutenberg_style_engine_get_stylesheet_from_context(). (#44248) This is so tests and other usages of gutenberg_enqueue_stored_styles() can bypass, or at least don't have to rely on, the global constant `SCRIPT_DEBUG` to determine whether the output is prettified.
I just cherry-picked this PR to the wp/6.1 branch to get it included in the next release: 964827e |
…sts to 6.1. This changeset backports the following changes: - Implement [WordPress/gutenberg#42880 gutenberg#42880]: Backport script loader: enqueue stored block supports styles - Allow a way to bypass `SCRIPT_DEBUG` in tests. See [WordPress/wordpress-develop#3259 (comment) comment] and the related [WordPress/gutenberg#44248 Gutenberg pull request] Props ramonopoly, gziolo, bernhard-reiter, audrasjb, costdev. See #56467. Built from https://develop.svn.wordpress.org/trunk@54214 git-svn-id: http://core.svn.wordpress.org/trunk@53773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…sts to 6.1. This changeset backports the following changes: - Implement [WordPress/gutenberg#42880 gutenberg#42880]: Backport script loader: enqueue stored block supports styles - Allow a way to bypass `SCRIPT_DEBUG` in tests. See [WordPress/wordpress-develop#3259 (comment) comment] and the related [WordPress/gutenberg#44248 Gutenberg pull request] Props ramonopoly, gziolo, bernhard-reiter, audrasjb, costdev. See #56467. Built from https://develop.svn.wordpress.org/trunk@54214 git-svn-id: https://core.svn.wordpress.org/trunk@53773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sorry @ockham there's a small update to this code in #44254 The change is reflected in the Core patch #44254 just syncs the two. I was going to cherry pick but I see from the commit history you've been doing them so I didn't want to mess up the process. |
…sts to 6.1. This changeset backports the following changes: - Implement [WordPress/gutenberg#42880 gutenberg#42880]: Backport script loader: enqueue stored block supports styles - Allow a way to bypass `SCRIPT_DEBUG` in tests. See [WordPress#3259 (comment) comment] and the related [WordPress/gutenberg#44248 Gutenberg pull request] Props ramonopoly, gziolo, bernhard-reiter, audrasjb, costdev. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54214 602fd350-edb4-49c9-b593-d223f7449a82
What?
Allowing
gutenberg_enqueue_stored_styles()
to pass down formatting options togutenberg_style_engine_get_stylesheet_from_context()
.Context: WordPress/wordpress-develop#3259 (comment)
Why?
So tests and other usages of
gutenberg_enqueue_stored_styles()
can bypass, or at least don't have to rely on, the global constantSCRIPT_DEBUG
to determine whether the output is prettified.How?
See "What?"
Testing Instructions
Run the tests!
npm run test:unit:php /var/www/html/wp-content/plugins/gutenberg/phpunit/script-loader.php
Smoke test a development site by creating a post with some block support styles, and checking the resulting styles in the frontend.
For example,
This example block code
Should generate the following CSS in development mode: