-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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: Prevent duplicate CSS for block style variations #6827
Global Styles: Prevent duplicate CSS for block style variations #6827
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
I noticed while creating this backport of WordPress/gutenberg#62465 that there's a difference in signature between core and Gutenberg for Before this change: Core: I'll try and sort this out in time for beta 3. |
The PR modifying the function signature in Gutenberg was WordPress/gutenberg#41217. From WordPress/gutenberg#41217 (comment) it looks like it the fact the PR wasn't backported was already known however perhaps not that "everything will be fine" as suggested after WordPress/gutenberg#46579. As far as I can tell, I don't think there'll be any harm in updating |
I've made the required updates from WordPress/gutenberg#41217. Flagging this as ready for review once the Gutenberg PR lands. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
* @return array The block nodes in theme.json. | ||
*/ | ||
private static function get_block_nodes( $theme_json ) { | ||
$selectors = static::get_blocks_metadata(); | ||
private static function get_block_nodes( $theme_json, $selectors = array(), $options = array() ) { |
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've checked these changes against WordPress/gutenberg#41217 and smoke tested this PR.
LGTM
Thanks for cleaning that up.
This PR is testing well for me. For blocks with the block style variation applied, I'm seeing the following, related classnames in the class attribute in both the editor and frontend:
|
For the moment, this is expected. The |
Co-authored-by: Mukesh Panchal <[email protected]>
Just a quick note that applying this patch on top of the latest trunk (after the custom CSS fix) still shows everything working as expected 👍 |
Committed at https://core.trac.wordpress.org/changeset/58422 |
This PR backports the PHP updates from: WordPress/gutenberg#62465
It now also includes the missing changes to
get_block_nodes
from WordPress/gutenberg#41217.The changes prevent redundant or duplicate CSS being generated for block style variations.
Test Instructions
/styles/partial.json
Custom
block style variation.is-style-custom-*
css class matchedTrac ticket: https://core.trac.wordpress.org/ticket/61443
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.