Post

It’s a real shame that folk a decade ago weren’t warning developers against utterly insane things like CSS-in-J —  oh.

GitHub@github.com

GitHub.com has fully moved off CSS-in-JS to CSS Modules, resulting in 55% less server-side render time and 25% faster component init. https://github.blog/engineering/architecture-optimization/improving-site-performance-by-shipping-more-css/

26 reposts123 likes

Ah yes, people are so unfair for having a mental model of "CSS-in-JS" that is informed by: 1. The seminal CSS-in-JS talk by vjeux who coined the phrase and showed a 100% runtime implementation. 2. Dominant implementations like Emotion and Styled Components.

If a library author uses a term historically associated with runtime execution, and shows people a syntax that looks like runtime execution (“but we have a special compiler that removes it, don't worry”), then turning around and calling people unfair for having the wrong idea is a bit cheeky.

I don't think they even have fixed the CSS-in-JS though. They aren't using native `with {type:css}` imports. This is just an extra compile tool so that developers can work with CSS, and use CSS variables instead of manipulating it, but the output is still JS.

I'd add: the CSS on the GitHub site is pretty awful. That they used AI to write most of it explains a lot (LLMs love !important)...

Keith Henry@k17.dev

Today I had to dig into GitHub's CSS - it's a mess of sub-tailwind classes with overriding !important flags everywhere, a mix of rem and px sizes, with at least 2 different naming conventions. It must be horrible to work with.

I can imagine all of the 1-pagers and RFCs written by senior engineers at medium to large organizations ten years ago, that got paid millions to make these changes. I wrote the RFC to move away from CSS in JS in a previous role undoing the damage 🫠

Yeah, it smacks of that kind of navel-gazing over-engineering, where someone is probably proud how their proprietary design system improves on vanilla CSS by adding terse cascading styles that can be easily applied, once learnt. And then someone added !important to a component and messed it all up 🤷

I’m not a fan of CSS Modules anymore either, but the crucial difference is that there’s no more runtime. The object only contains a map of class names.

And at least LLMs weren’t trained on that decade of inefficient tooling, thus ensuring this insane broken pattern doesn’t continue - oh

The blog post reads as if the result was some kind of a breakthrough. I wonder why they didn’t make it clear that they had an outdated stack, there’s no shame in that.