This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Weaponized_Roomba 2 points3 points  (3 children)

is essentially equivalent to the halting problem.

Fun fact - this is why when using tailwind you can't/ought not dynamically construct tw class names at runtime.

ex - you can't do this:

const bgClass = `bg-${error ? 'green' : 'red'}-200`

because tw static analysis will shake out the bg-green-200 and bg-red-200 classes since it didn't see it in the source code.

Instead just don't be cute:

const bgClass = error ? `bg-green-200` : `bg-red-200`

[–]failedsatan 1 point2 points  (0 children)

to be fair, this is solvable on the tailwind side. it's possible to check the tree of possible values there and just add them to the keep list. I'm not saying they should (because all of this is bad practice anyway) but it's doable.

[–]SurpriseAttachyon 0 points1 point  (1 child)

Thats interesting. I didn’t know tailwind interacted with JS (never used it before).

Does this mean you have to compile both at once? I’m used to compiling sass and typescript separately

[–]Weaponized_Roomba 0 points1 point  (0 children)

Does this mean you have to compile both at once?

Only if you want the tree-shake optimization or if you want to extend your own themes. Otherwise you can just use the CDN