r/webdev • • 3h 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/
118 Upvotes

28 comments sorted by

87

u/allurb4se 2h ago

CSS-in-JS always felt like weird to me. Having to convince my then CTO and the senior developer that it made very little sense was a painful and fruitless endeavor

13

u/smieszne 2h ago

Yeah, and I remember dev convincing me "CSS-IN-JS IS ACTHUALLY FASTER" I don't remember why.

3

u/captain_obvious_here back-end 35m ago

It's because it's internet-fast.

35

u/Nervous-Toe5784 2h ago

The SSR gain makes sense since runtime libs like styled-components or emotion have to serialize and inject styles on every render, and they also need client-side context which doesn't play well with React Server Components. CSS Modules get extracted at build time, so the server just ships static class names and a plain stylesheet. If anyone misses the co-location, zero-runtime options like vanilla-extract or Panda CSS give you most of the DX without the render cost.

10

u/ronnygiga 1h ago

Sir this is Reddit, if people knew how to read, this would be the very top comment.

9

u/captain_obvious_here back-end 33m ago

I still don't understand how people could think CSS-in-JS was a good idea, and solved anything regular CSS struggled with.

And now it's deep into projects, it probably costs a fortune to migrate out of this.

•

u/danemacmillan 7m ago

Talking about how nonsensical it was always made me feel like I was taking crazy pills.

15

u/LieNaive4921 2h ago

Three-YEAR migration???

18

u/MrHandSanitization 1h ago edited 1h ago

Likely something widespread. Agreed to tackle bits here and there when touching files and yada yada. Then when a lot was organically moved, a final push was made. Yada yada.

1

u/thekwoka 1h ago

Yeah, ntm just doing checks of "is this better?" on limited pages.

1

u/MrHandSanitization 1h ago

Wut?

•

u/thekwoka 18m ago

They don't just do a migration of these systems based on whims.

You do parts, see if the metrics support it being better, how do the devs feel about the change, etc.

•

u/MrHandSanitization 17m ago

Where did I say they didn't?

•

u/thekwoka 13m ago

....I never said you said anything?

Do you not know what "ntm" means?

2

u/catcherfox7 53m ago

That's how a non-crucial large scale projects are often done in massive organizations. Github it is mostly a rails monolith, and with ~1k employees, the coordination efforts really pile up. Besides, have you even tried to convince leadership to prioritize anything without them ask a bunch of metrics, impacts, estimations, etc?

The biggest win here is the determination of whoever drove this project to completion. That's the sort of work that is often overlooked by organizations.

•

u/Kriem 11m ago

"Hey boss, I have a plan for optimization. It'll only take three years to implement"

5

u/VayuAir 2h ago

I am glad the AI era has forced SSR back in focus. I always thought CSR was janky way of doing things

3

u/Ronin-s_Spirit 1h ago

Both before and after are fucking stupid. From the very beginning they could've had css files for each url route + generic css. Scoping issue in CSS is a skill issue, CSS classes and custom HTML tags have been around for a long time now.

11

u/thekwoka 1h ago

Scoping issue in CSS is a skill issue

And at an organization, you will have those, so you want tooling that solves it.

4

u/AshleyJSheridan 1h ago

It always felt like a problem created by devs who never really understood (or even wanted to understand) CSS.

•

u/sauland 22m ago

if you say this you must have only worked on simple websites. good luck scoping vanilla CSS with BEM on a product with multiple teams working on it and hundreds of components shared all across the app. Using CSS modules completely eliminates thinking about class names outside of a single component's scope. there isn't a single reason why you should not use it.

•

u/AshleyJSheridan 10m ago

Nope, I say this as someone who's worked on shared CSS projects that were used across multiple websites built in multiple languages (C#, PHP, node, Angular, etc), that also supported multiple brands.

Was it complicated? Of course it was. Did it work? Absolutely. Did it require devs to understand CSS? Yes.

Anyone saying that vanilla CSS doesn't scale well on large projects just doesn't know how to write CSS as well as they think they do.

•

u/sauland 19m ago

is this satire? do you think github is built with plain HTML pages where you can just have a css file per page?

•

u/Ronin-s_Spirit 7m ago

There's literally no reason not to. You can interleave CSS files for a single request, then all that remains is writing good CSS queries or distinct classes or HTML tags to prevent scoping issues. Having interleaved CSS files for different routes will decrease the chance of getting CSS conflicts by itself (before even getting to skill issues). Github is still a single website, they should know enough about it to not mess up.

1

u/ringsushy 30m ago

Three years sounds slow until you're ripping runtime styles out of a huge component library without breaking every page.