Hacker News new | ask | show | jobs
by MrJohz 1028 days ago
There are precious few type safe templating systems, and they're mostly fairly niche. And even then, while they're often type safe, the developer experience is typically lacking, with minimal IDE support. Meanwhile, Vue redesigned their API partly because types were difficult to properly implement in previous versions, and then built an entire LSP to facilitate that.

Likewise, your cursory search for CSS modules in rails mainly returns blog posts where people try and hack things together to get CSS modules working well enough. The top result for me literally wrote "I tried to find a cool way to integrate CSS Modules into our Rails project, but I cannot", then explains how they parsed CSS by themselves. (I can't get further than that, because Medium.) Meanwhile, adding CSS modules to a project bundled with Vite is literally just a matter of naming your files `.module.css` instead of just `.css`.

Tailwind is a bit of an exception, as it seems to be more popular with backend frameworks, I think because it relies less on Javascript idioms like imports. I suspect we'll see it - or at least similar ideas - integrated into more frameworks over time.

But to me coming from the frontend, this sort of stuff is table-stakes - having IDE support, having Typescript support (and good TS support), being immediately accessible without spending a day fiddling with fifteen different plugins, etc.

1 comments

Java Server Pages? Spring MVC? asp.net MVC? razor pages? go templates? None of these are niche and they all have had first class IDE support for, again, literally decades.

Concepts like CSS modules may not be as trendy in server side rendering frameworks, but that doesn't mean the concept itself is inherently limited to SPA's.

Things like IDE support have been table stakes for backend developers working in static languages for a very long time. Javascript tooling is just now finally catching up.

> Concepts like CSS modules may not be as trendy in server side rendering frameworks, but that doesn't mean the concept itself is inherently limited to SPA's.

They are, however, inherently limited to Javascript. Because CSS Modules are explicitly a Javascript feature.

There's no reason you can't have a build system that does the same thing in a different language. They are not "explicitly" a feature of javascript at all.
They literally are. CSS modules as a concept and any existing specs are very explicitly Javascript only and target Javascript only.

Yes, you could do a similar thing in other languages, and people will, but simply by definition those are not CSS Modules, and might diverge from the actual "standard" (which it isn't yet)

CSS Module Scripts are not the same as the third party CSS Modules library that most people are referencing when discussing CSS Modules.