Ensure classes defined in Nuxt config are imported#1013
Conversation
👷 Deploy request for nuxt-tailwindcss pending review.Visit the deploys page to approve it
|
PR Summary
|
| if (value) sources.push(`inline(${JSON.stringify(value)})`) | ||
| }) | ||
|
|
||
| await nuxt.callHook('tailwindcss:sources:extend', sources) |
There was a problem hiding this comment.
sorry it took me a while, I was thinking about this hook as passing JSON.stringified strings here would have severe effects. Let me think of some ideas and apply onto this PR
There was a problem hiding this comment.
I understand! But worth noting that I didn't add this call to JSON.stringify: it was already in the codebase and I moved it.
I had to move it here so that only the bit between () was stringified rather than the whole string.
🔗 Linked issue
Resolves #1011
❓ Type of change
📚 Description
As discussed with @ineshbose in #1011, moving to the new directory structure of Nuxt 4 causes the two
classkeys innuxt.config.tsto no longer be caught by Tailwind. This PR puts them back using theinline()keyword.Note that it also had to move
JSON.stringifyhigher up in the code, since these need stringifying inside the keyword. This shouldn't cause any issues because the variable is private and only used once.Happy to make any changes requested!