Exported theme.json includes empty collections #53199
Labels
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
[Type] Bug
An existing feature does not function as intended
Description
When the theme is exported (either via the 'Export Theme' menu item in the site editor or via a plugin such as Create Block Theme which calls
WP_Theme_JSON_Gutenberg()
) the theme.json file includes values that are unnecessary.Some of these values include default values which shouldn't be included in the theme.json files.
Most agregious, however, are a number of empty collections. These are mentioned in more detail in this Create Block Theme issue. In short, the inclusion of the
spacingSizes:[]
collection causes the Site Editor to NOT show the default spacing sizes to the user.Other empty collections (such as colors) don't seem to negatively impact the user's experience but probably shouldn't be included in the export.
Other values (such as
settings.color.background:true
) are default values and shouldn't be exported in the theme.json file.Step-by-step reproduction instructions
Create a 'blank' theme. (Using Create Block Theme is helpful for this.)
Make a small change to the theme (for example changing the content width).
Export the theme and observe the theme.json values.
Note the inclusion of empty collections as well as default values which should be excluded from the export.
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: