r/css • • 5d ago

Article GitHub Ditches CSS-in-JS for CSS Modules, Reports 55% Faster SSR after Three-Year Migration

https://www.infoq.com/news/2026/11/github-css-migration/
155 Upvotes

17 comments sorted by

70

u/jonassalen 4d ago • Bravo

Is that a surprise? CSS-in-JS was a bad idea to begin with. 

12

u/One-Butterfly-9752 4d ago

It always upset me

8

u/minmidmax 4d ago

Yeah, it was always a bullshit idea. At least people are coming around on it!

21

u/_HMCB_ 4d ago

Why is everything so complex nowadays. 😣

10

u/gajus0 3d ago

CSS-in-JS is not the issue here.

https://github.com/bamboocss/bamboo

Bamboo is an example of CSS-in-JS that compiles to pure CSS at build time while still allowing to colocate styles with components, write dynamic style expressions, etc.

Ironically, I am also the author of (once popular) react-css-modules, which is the approach that GitHub team took.

10

u/kekeagain 4d ago

I think as CSS continues moving forward in scoping, relational styling, programmatic constructs, and with AI making the "tedious" bits like naming moot, I think people will being asking if the Tailwind and CSS-in-JS abstraction layer is relevant today.

6

u/KontoOficjalneMR 3d ago

Tailwind was always a horrible idea, glad people are finally noticing that it's the same as in-lining styles in HTML, practice we've gladly abandoned in the last century that for some reason someoen brought back

1

u/VRT303 2d ago

The only reason for Tailwind is that CSS is well cascading style sheets and teams were always shit at scoping. Not even stuff like BEM you could get some people to use constantly.

So you'd get someone breaking subtly or very visibly the whole website because of changing the wrong thing. Or corporate image updates still taking forever because there's 9 different sass less or scss primary-blues defined by those colleagues that don't care.

1

u/KontoOficjalneMR 2d ago edited 2d ago

All of that is true.

But it's still just 9 different sass/less/scss blues. Not literally thousands of bg-sky-100 classes that now need to be changed across hundreds of files. And you of course end up missing one because the template is bg-<% theme ? "sky" : "red" %>-100 and it doesn't show up in greps.

I kid you not I've seen a project where one of those classes was simply redefined to a different colour, because human laziness knows no bounds.

13

u/yihuaxiang 4d ago

The 55% SSR number is the part I'd pay attention to. A lot of the CSS-in-JS cost wasn't the syntax, it was generating or injecting styles at request time on the server. CSS Modules (or plain CSS files) can be built once and served as static assets, so the HTML doesn't have to wait on a runtime to emit styles. That's a much bigger deal on a large app than whether you like writing className or not.

2

u/dusanodalovic 4d ago

three years is what stands out to me. while both were live on the same pages, how did they keep the old runtime styles and the new css files from fighting over order and specificity? did they go page by page or component by component

1

u/TheJase 4d ago

CSS Cascade Layers would solve that immediately

5

u/New-Peach4153 4d ago

I'd like to say GitHub is typically a buggy/bad UX whenever I bother using the website

1

u/Lurker-8580 4d ago

Reinventing the wheel over and over again

1

u/HongPong 3d ago

across all of GitHub how much css is there even? seems over engineered

1

u/putotoystory 2d ago

CSS-in-JS is a terrible idea, just like how tailwind pollutes the class attribute. I just developed .cssx instead and it works best with tsx.

-1

u/FigureNo77 3d ago

just use static css files