Commit 120d309
[wp-block-themes]: document theme.json slug-normaliser bug class (#59)
## Summary
Documents a silent failure in theme.json: WordPress hyphenates
preset/custom slugs before emitting CSS vars, so a handwritten `var()`
reference to the un-normalised slug resolves to nothing and quietly
falls back. No error, layout looks roughly right — invisible without
computed-style inspection.
Examples:
- slug `3xl` → `--wp--preset--font-size--3-xl`
- slug `cardShadow` → `--wp--custom--card-shadow`
Under the hood, `WP_Theme_JSON` runs every slug through
`_wp_to_kebab_case()`, which splits at digit/letter boundaries,
camelCase transitions, and non-alphanumeric characters.
## Changes
- **`skills/wp-block-themes/references/theme-json.md`** — new "Slug
normalisation gotcha" section with the explanation and a grep pattern
for catching un-normalised references.
- **`skills/wp-block-themes/references/debugging.md`** — new bullet
under "Styles not applying" pointing at the gotcha section.
Co-authored-by: mikeyarce <mikeyarce@git.wordpress.org>
Co-authored-by: karmatosed <karmatosed@git.wordpress.org>
Co-authored-by: bgrgicak <berislavgrgicak@git.wordpress.org>1 parent 977b407 commit 120d309
2 files changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
0 commit comments