Changes to global styles in Gutenberg 9.1

Home » Blog » Changes to global styles in Gutenberg 9.1

In Gutenberg version 9.1, the structure of the experimental-theme.json file is being changed.

Jump straight to the details on Github

The JSON is still separated in two scopes (contexts), global and block type.

What was previously two different objects, presets and features, are now bundled together inside settings. Styles remain unchanged.

In your existing JSON file, create a new object called settings and place the contents of the presets and features objects inside of it. These are now nested at the same level in the hierarchy.

Example structure of a experimental-theme.json file before the change:

{
	"global": {
		"presets": {
		     ....
		},
                "features": {
		     ....
		},
		"styles": {
			"typography": {
				...
			},
			"color": {
				...
			}
		}
	},
	"core/site-title": {
		"styles": {
			"typography": {
				...
			}
		}
	}
}

After:

{
	"global": {
		"settings": {
		     ....
		},
		"styles": {
			"typography": {
				...
			},
			"color": {
				...
			}
		}
	},
	"core/site-title": {
               "settings": {
		     ....
		},
		"styles": {
			"typography": {
				...
			}
		}
	}
}

I am going to update the code examples and lessons but because Gutenberg is on such a short release schedule, I can not guarantee that everything will be updated in time for 9.1, since I am also working on the new default theme.