Skip to content
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

Always output core block global styles after base global styles #58761

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

tellthemachines
Copy link
Contributor

What?

Brings the changes from WordPress/wordpress-develop#6010 into Gutenberg.

When should_load_separate_core_block_assets is true, core block global styles should now be loaded right after base global styles, inside the global-styles-inline-css tag. This matches the loading order when should_load_separate_core_block_assets is false, as well as the order inside the editor iframe.

When should_load_separate_core_block_assets is true, only the styles relevant to the blocks on the page should be loaded.

Testing Instructions

  1. Publish a post with a Quote or a Button block and one without. Make sure the post template itself doesn't contain these blocks.
  2. In the front end, check that for the post with the Quote, quote global styles are loaded, but for the post without the Quote they aren't.
  3. Check that the block global styles are loaded after the base global styles (this can be easily checked by e.g. adding a background color to the Button block in global styles, and checking that style is output after the base global styles default button background color)

@tellthemachines tellthemachines added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Backport from WordPress Core Pull request that needs to be backported to the a Gutenberg release from WordPress Core labels Feb 7, 2024
@tellthemachines tellthemachines self-assigned this Feb 7, 2024
Copy link

github-actions bot commented Feb 7, 2024

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 props-bot label.

Core SVN

Core Committers: Use this line as a base for the props when committing in SVN:

Props isabel_brison, poena, oandregal.

GitHub Merge commits

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented Feb 7, 2024

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/global-styles-and-settings.php

Copy link
Contributor

@carolinan carolinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the PR manually and it works as described.

Copy link
Member

@oandregal oandregal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making sure both codebases are in sync.

@tellthemachines tellthemachines merged commit 0586ddf into trunk Feb 7, 2024
67 checks passed
@tellthemachines tellthemachines deleted the fix/style-loading-order branch February 7, 2024 21:22
@github-actions github-actions bot added this to the Gutenberg 17.7 milestone Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport from WordPress Core Pull request that needs to be backported to the a Gutenberg release from WordPress Core Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants