Restore theme.json
updates to Tailwind configuration during watch
process
#79
Labels
Type: Regression
Things that used to work, but don’t anymore
Previous functionality
Updating the
theme.json
file would trigger Tailwind to rebuild the CSS file with new colour and width properties from thetheme.json
file.Current status
Two things seem to have changed:
theme.json
file withrequire
caches its contents, and those contents aren't updated when the file changes.tailwind.config.js
.Workaround
Right now, the easiest way around this is to terminate the
watch
process after changing thetheme.json
file and then to restart it.Future fixes
There are two options for the caching issue:
require
cacherequire
I'm not sure which would be more performant, or if it would make enough of a different to matter.
I want to wait until Tailwind's Oxide compiler is released before putting too much energy into the second issue. One approach that would definitely work would be to watch the
theme.json
file and then to trigger something equivalent totouch tailwind.config.js
. I'd prefer not to add more dependencies, though, and it feels like there should be a better way.That said, my sense is that Tailwind has consciously been updated to run plugins less often, and that plugins that could produce different values on future runs may have limited options.
Discussed in #78
Originally posted by victorcl November 13, 2023
Hi and thanks for this great wordpress theme starter.
I am having an issue which I haven't been able to sort out. When I make changes to the theme.json, watch gets triggered with "Rebuilding..." but these changes are not available to tailwind.
But if I run "npm run dev" then the changes from theme.json are available to tailwing. But then if I make a change to any other file that triggers "watch" then I loose the theme.json changes again, they reset to the original values.
Any idea¿
Thanks.
The text was updated successfully, but these errors were encountered: