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

Theme Export: Sort theme.json properties #39842

Merged
merged 2 commits into from
Apr 1, 2022
Merged

Conversation

scruffian
Copy link
Contributor

What?

This sorts the keys of theme.json on export alphabetically.

Why?

The order of the properties on the export currently are not predictable, which means that when you export the theme.json back to an existing theme the diff doesn't match as the properties are in a different order.

How?

Uses a utility function.

Testing Instructions

  • Switch to a block theme
  • Export your theme
  • Check that the properties are sorted alphabetically
  • Copy the theme.json back to the theme source
  • Do a diff on the theme
  • Is the diff easier to read?

Notes

I'm not sure if this is really what we want. Often the properties don't read as well in this order, but without a predictable order we will continue to have problems when creating diffs from the site editor.

cc @WordPress/block-themers

@scruffian scruffian added the [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. label Mar 29, 2022
@scruffian scruffian self-assigned this Mar 29, 2022
Copy link
Contributor

@MaggieCabrera MaggieCabrera left a comment

Choose a reason for hiding this comment

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

I LOVE that you did this, thanks so much. Works as intended with Pendant.

@scruffian scruffian merged commit eb4fc8a into trunk Apr 1, 2022
@scruffian scruffian deleted the update/theme-export-ksort branch April 1, 2022 12:17
@github-actions github-actions bot added this to the Gutenberg 13.0 milestone Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme.
3 participants