logoalt Hacker News

efortisyesterday at 4:17 PM1 replyview on HN

CSS Modules are a simpler solution to cascading problems. They create unique class names, so your classes don't clash [1]. And they don't have the two main downsides of TW, which are readability [2] and tooling. Tooling for debugging and experimenting interactively with Chrome and FireFox DevTools.

[1] https://x.com/efortis/status/1888304658080256099

[2] https://github.com/ericfortis/tailwind-eye


Replies

culitoday at 2:08 AM

Don't most modern CSS tools create unique class names? I know styled-components did.

Recently I've been using linaria which is a drop-in replacement for styled-components (exact same API) but its zero runtime. All the CSS is compiled during build (similar to vanilla extract, panda CSS, etc).

I really prefer things like styled-components or Linaria or CSS Modules where you can just write straight up CSS. If you ever decide to switch your tool you should always be able to just copy-paste your CSS away. You don't get that with Tailwind or "styles-as-objects" stuff (StyleX)

show 1 reply