Skip to content

Global Styles: consider loading user styles after theme styles #34141

@jffng

Description

@jffng

Description

Currently styles load in the following order:

  1. Block library styles
  2. Global styles — core + theme.json + user styles set via the site editor. All of these are combined into global-styles-inline-css
  3. Theme styles

For example, this is from emptytheme:

Screen Shot 2021-08-18 at 10 41 12 AM

This loading order can cause unexpected behavior when the theme wants to specify some defaults that are not entirely possible via theme.json, but still allow for user styles to take precedence. For an example of where this can create unexpected behavior, see Automattic/themes#4435

What is your proposed solution?

Within global styles, it could be useful to separate user styles from the core + theme.json styles. This way, the loading order could be:

  1. Block library styles
  2. Global styles — core + theme.json
  3. Theme styles
  4. Global styles — user styles

Metadata

Metadata

Assignees

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.[Status] In ProgressTracking issues with work in progress

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions