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
{{ message }}
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
I hope this is relatively easily explained by my two screenshots :)
JIT is working great in a Next.js React app, however I have come across an issue which I'm not too sure will be solvable as I don't have enough technical understanding of the order in which processes work here.
TL;DR: I want to pass in props to a component so that classes are generated based on those props. As soon as the four lines highlighted in screenshot 1 are added, the app crashes with an unknown word error. I assume this is because purge is combing through the files and doesn't recognise these lines. To fix this, I tried adding a default value with an || selector (screenshot 2), and this stops the app from crashing. The correct CSS is generated in the browser, but I assume due to the order in which things occur, those classes are not generated by Tailwind JIT and therefore not applied.
My question is twofold:
Is there a way to solve this now?
Is this something that can be technically fixed in upcoming TWJIT builds?
Thanks! Loving the promise of JIT and TW in general :)
The text was updated successfully, but these errors were encountered:
Hey! This is just a limitation of how the whole thing works, classes must be statically extractable in advance because we don't ship any sort of run-time to the browser. You'll want to read about writing purgeable HTML in the Tailwind docs, as the same constraints apply to the JIT engine 👍🏻
If you want to try a CSS-in-JS flavor of Tailwind that does support this sort of thing, check out twin.macro.
Uh oh!
There was an error while loading. Please reload this page.
What version of @tailwindcss/jit are you using?
0.1.8
What version of Node.js are you using?
14.16.0
What browser are you using?
Chrome
What operating system are you using?
MacOS
Reproduction repository
I hope this is relatively easily explained by my two screenshots :)
JIT is working great in a Next.js React app, however I have come across an issue which I'm not too sure will be solvable as I don't have enough technical understanding of the order in which processes work here.
TL;DR: I want to pass in props to a component so that classes are generated based on those props. As soon as the four lines highlighted in screenshot 1 are added, the app crashes with an
unknown word
error. I assume this is because purge is combing through the files and doesn't recognise these lines. To fix this, I tried adding a default value with an||
selector (screenshot 2), and this stops the app from crashing. The correct CSS is generated in the browser, but I assume due to the order in which things occur, those classes are not generated by Tailwind JIT and therefore not applied.My question is twofold:
Thanks! Loving the promise of JIT and TW in general :)
The text was updated successfully, but these errors were encountered: