You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you work with WordPress' Full Site Editing and integrate Tailwind v4 with it, welcome!
I'd like to discuss a challenge I'm facing and to see some ideas come out of this.
As we all know, with Tailwind, we define our theme in @theme { ... }, with --color-*, --spacing-* CSS custom variables. These variables are then used for utility classes like text-*, bg-*, border-*, my-*, etc...
For WordPress with its new Full Site Editing, a theme.json with settings for colors, spacing, ... is used:
For each of those settings, WordPress generates a CSS variable, i.e. --wp--preset--color--base: #FFFFFF, --wp--preset--spacing--auto: auto, ...
The challenge I have is to figure out where I should actually define my theme. Should the colors be in "theme.json" or "theme.css"?
If I define the colors in @theme, then I would need to set settings.color.palette[0].color = "var(--color-base)". Otherwise, I would need to define --color-base: var(--wp--preset--color--base); in @theme.
Another challenge is that while Tailwind uses text-base, bg-base for setting colors, WordPress generates has-base-color and has-base-background-color.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
If you work with WordPress' Full Site Editing and integrate Tailwind v4 with it, welcome!
I'd like to discuss a challenge I'm facing and to see some ideas come out of this.
As we all know, with Tailwind, we define our theme in
@theme { ... }
, with--color-*
,--spacing-*
CSS custom variables. These variables are then used for utility classes liketext-*
,bg-*
,border-*
,my-*
, etc...For WordPress with its new Full Site Editing, a
theme.json
with settings for colors, spacing, ... is used:For each of those settings, WordPress generates a CSS variable, i.e.
--wp--preset--color--base: #FFFFFF
,--wp--preset--spacing--auto: auto
, ...The challenge I have is to figure out where I should actually define my theme. Should the colors be in "theme.json" or "theme.css"?
If I define the colors in
@theme
, then I would need to setsettings.color.palette[0].color = "var(--color-base)"
. Otherwise, I would need to define--color-base: var(--wp--preset--color--base);
in@theme
.Another challenge is that while Tailwind uses
text-base
,bg-base
for setting colors, WordPress generateshas-base-color
andhas-base-background-color
.Is there a way to unify them?
Beta Was this translation helpful? Give feedback.
All reactions