Hacker News new | ask | show | jobs
by SavantIdiot 1694 days ago
I still don't get CSS in javascript. Why blow up the size of the payload when linking to a compiled style sheet is sufficient? Yes, I realize some components are one-offs, but I think the discpline required to keep CSS clean is a small price to pay for mitigating bloat.
1 comments

Tailwind isn’t css in js. It’s just css. They’ve built endless css mini classes that effectively give you enhanced inline styles. So stuff like hover variations are possible by adding the class directly to your element.

You can use the just in time compiler to generate the classes on the fly rather than importing millions of them in as a style sheet. That’s js, but really it’s just a regex that scrapes things that look like tailwind class names from your html and generates those classes for you.

Yes, I know that, but in the article the OP is loading CSS via JS.
Ah, gotcha, the theme stuff at the bottom? Yeah, I don’t like that myself. I’ve been there with materialui and it’s depressing seeing runtime css kill your js performance for absolutely no gain.