Gutenberg Plugin: Correctly enqueue core block theme styles#54936
Gutenberg Plugin: Correctly enqueue core block theme styles#54936t-hamano wants to merge 1 commit into
Conversation
|
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/blocks.php |
ee82e50 to
458f1b2
Compare
|
👋 I've been pinged here but I don't have much context about this work, sorry. Looking at |
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
458f1b2 to
c7d3482
Compare
|
Flaky tests detected in c7d3482. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7924350235
|
|
This problem does not reproduce with the latest Gutenberg. Perhaps it was resolved by #60098. |
Closes #54783
Related to: #31239
What?
This PR ensures that the Gutenberg plugin's core block theme styles properly override the WordPress core block theme styles.
This PR solves the following two problems:
theme.scsswith the Gutenberg plugin, the style will be overridden in the coretheme.scssWhy?
Regarding the first problem, please check the issue comments for details.
Regarding the second problem, I think it's because the style handle name (
wp-block-{$block_name}) passed to thewp_register_style function()is already in use.How?
Remove core theme styles via
wp_deregister_style(). For blocks without a main stylesheet, I added the-themesuffix to the handle name to ensure that styles are enqueued correctly.Testing Instructions
Here we will test the code block and template parts block.
wp-block-styles, so you can test the code I've made.trunk
Looking at the code, we see the following:
Even if you update the theme.scss of these two blocks on the Gutenberg plugin side, the styles should not be reflected.
This PR
Looking at the code, we see the following: