Skip to content

Ports theme.json changes for beta 3#1411

Closed
oandregal wants to merge 5 commits intoWordPress:masterfrom
oandregal:add/theme-json-changes-beta-3
Closed

Ports theme.json changes for beta 3#1411
oandregal wants to merge 5 commits intoWordPress:masterfrom
oandregal:add/theme-json-changes-beta-3

Conversation

@oandregal
Copy link
Copy Markdown
Member

@oandregal oandregal commented Jun 22, 2021

Related #1408

  • Add _wp_to_kebab_case function
  • Add CSS Custom Properties within preset classes.

How to test

  • Create a file at src/wp-content/themes/twentytwentyone/theme.json with the following contents:
{
    "version": 1,
    "settings": {
        "color": {
            "palette": [
                {"slug": "black2black", "color": "#000", "name": "Black"}
            ]
        }
    }
}
  • Start the bundled wordpress-develop enviroment.

Front-end:

  • Go to the front-end and inspect the contents of the global-styles-inline-css embedded stylesheet. The expected result is that the corresponding CSS Custom Property and classes for that color are present and look like this:
body {
  /* ... */
  --wp--preset--color--black-2-black: #000;
}
.has-black-2-black-color {
  color: var(--wp--preset--color--black-2-black) !important;
}
.has-black-2-black-background-color {
  background-color: var(--wp--preset--color--black-2-black) !important;
}

Post editor:

  • Load a post and confirm the presence of the CSS Custom Property above. Also the classes and that they use the custom property as well.

@jorgefilipecosta
Copy link
Copy Markdown
Member

Committed in ab86a02.

@oandregal oandregal closed this Jun 23, 2021
@oandregal oandregal deleted the add/theme-json-changes-beta-3 branch June 23, 2021 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants