Site Editing: missing global inline styles
Description
Since 9.9.0 with the using the new theme.json structure, on the front end, the global-styles-inline-css is missing styles such as has-x-color and has-x-background-color
Not sure if this is a bug or intentional.
If not a bug, is it now expected that themes need to take account of this by including all missing styles (that were previously loaded inline by Gutenberg) in their stylesheet?
WordPress information
- WordPress version: 5.6.1
- Gutenberg version: 9.9.0
- Are all plugins except Gutenberg deactivated? Yes
- Are you using a default theme (e.g. Twenty Twenty-One)? No. Testing emptytheme using new theme.json structure.
There is a breaking change in the experimental-theme.json, see https://make.wordpress.org/themes/2021/02/04/gutenberg-9-9-new-json-structure-for-theme-json-files/
So I am closing this issue. If the change don't fix your issue, please reopen it.
Yes, I did state that this occurs when using the new theme.json structure.
To expand further, this issue is when using the new structure: settings > defaults > color > palette
Not using the old structure which was: global > settings > color > palette
I am unable to re-open closed issues.
I will test again to see if I am not understanding the new structure or I am missing something really obvious.
I was missing also adding the color palette to the root level in addition to the defaults.
For example, this will NOT output the has-black-color style on the front end:
{
"settings": {
"defaults": {
"color": {
"palette": [
{ "slug": "black", "name": "Black", "color": "#000" },
{ "slug": "white", "name": "White", "color": "#fff" }
]
}
}
}
}
but also adding the palette to the root level like this will output has-black-color on the front end:
{
"settings": {
"defaults": {
"color": {
"palette": [
{ "slug": "black", "name": "Black", "color": "#000" },
{ "slug": "white", "name": "White", "color": "#fff" }
]
}
},
"root" : {
"color": {
"palette": [
{ "slug": "black", "name": "Black", "color": "#000" },
{ "slug": "white", "name": "White", "color": "#fff" }
]
}
}
}
}
So it seems that every style has to be written twice, once in the defaults level for the editor, and again in the root level for the front end.
Thanks, i reopend the ticket.
I think it is enough if you only use root. Maybe @nosolosw or @aristath can help.
If only using root then the custom palette is only available in the Site Editor, with the custom palette missing from the Post/Page Editor (it defaults to core palette instead).
:wave: Thanks for reporting, I can repro this bug. I'll work on a fix.