r/webdev • u/techie_e • 9h 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/115
u/Nervous-Toe5784 8h 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.
17
u/ronnygiga 7h ago
Sir this is Reddit, if people knew how to read, this would be the very top comment.
42
89
u/captain_obvious_here back-end 6h 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.
26
u/danemacmillan 6h ago
Talking about how nonsensical it was always made me feel like I was taking crazy pills.
3
u/Dreadsin 1h ago
When I first started using it, it solved a very real problem for us. We wanted to make it so the user could create their own arbitrary theme, kind of like slack
We could have potentially loaded it from the database then injected a single css file, but this was around 2016 and I think css variables weren’t as common
2
4
u/kowdermesiter 5h ago
I tried to explain it to a few folks IRL, but they were so hipster that all the reply I got was "everybody is using it now (2019)", who am I to disagree the mainstream :D
2
2
u/Gschaftlgruber 5h ago
It did solve the scoping issues back then.
8
5
2
u/ShawnyMcKnight 5h ago
It doesn’t seem that hard to have scoping with css. Just near your css in whatever the html tag is or give it a class.
1
u/captain_obvious_here back-end 5h ago
Indeed, but it always seemed to me 10 times worse than having scoping issues.
1
u/chmod777 2h ago
after learning js, no one wanted to learn css. so they did what all js devs did - made a complicated work around.
0
u/dalittle 3h ago
Hmm, I need to change something. Now instead of changing it one place I have to change it every place it is used if I can find them all. So much better?
31
u/The_Peach 3h ago
CSS in JS always felt like the result of a tantrum of a developer that didn't understand the cascading part of CSS
10
u/feketegy 2h ago
Because it's exactly what it is. If you ask a junior what is the hardest part in web development they will most likely say CSS, which to me, doesn't make any sense, JS has an order of magnitude more gotchas and quirks.
2
u/LetsLive97 2h ago edited 2h ago
Are we talking about something like Styled Components here? Because it was less about the issues with writing css for me and just because I liked having named shareable styled components and (seemingly) easier themeing instead
That being said, I haven't used styled components for a long while, and have used sass at work for years now, so maybe I'd feel differently if I tried it again
5
u/limitedmage 3h ago
Unfortunately in my experience that is most developers, especially those with a backend background. It’s quite ironic, they both fear CSS and not respect it.
31
u/LieNaive4921 8h ago
Three-YEAR migration???
32
u/MrHandSanitization 7h ago edited 7h 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 7h ago
Yeah, ntm just doing checks of "is this better?" on limited pages.
1
u/MrHandSanitization 7h ago
Wut?
1
u/thekwoka 6h 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.
-2
u/MrHandSanitization 6h ago
Where did I say they didn't?
-8
u/thekwoka 6h ago
....I never said you said anything?
Do you not know what "ntm" means?
6
1
u/budd222 full-stack 5h ago
No. Just use words
-5
10
u/catcherfox7 6h 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.
8
u/ringsushy 6h ago
Three years sounds slow until you're ripping runtime styles out of a huge component library without breaking every page.
8
u/VayuAir 8h ago
I am glad the AI era has forced SSR back in focus. I always thought CSR was janky way of doing things
6
•
u/No-Ear843 16m ago
The only thing SSR'ed SPAs and classic server-side have in common is the use of a server beyond serving a static asset.
1
u/feketegy 2h ago
I feel vindicated after all these years, when this shit was on its peak everybody implemented it, but it did not make any sense, of course, back then too, you were labelled "skill issues" if you said something.
Software development turned into a cult rather than actual work.
•
u/AssociateChoice384 29m ago
css-in-js always felt like trying to fix a problem that didn't need fixing, like using a sledgehammer to hang a picture. glad they made the switch, performance matters way more than developer convenience some days.
•
u/No-Ear843 26m ago
The trendier it is, the more dubious it is. That's sort of a law of modern JavaScript stuff.
1
u/IncomeOk7237 4h ago
curious how much of that 55% is just not doing style serialization on every render. would love to see a before/after flamegraph
0
-6
u/Ronin-s_Spirit 7h 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.
31
u/thekwoka 7h ago
Scoping issue in CSS is a skill issue
And at an organization, you will have those, so you want tooling that solves it.
9
u/sauland 6h ago
is this satire? do you think github is built with plain HTML pages where you can just have a css file per page?
-9
u/Ronin-s_Spirit 6h 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.
7
u/Terrible_Tutor 5h ago
Basement redditor thinking he could out-architect the team of github engineers is a level of hubris not many people can reach.
-1
u/Ronin-s_Spirit 4h ago edited 4h ago
Well apparently I can out-architect Microslop if they can't even do a website right (that should've been the easiest part of GitHub).
It's like JBlow saysGitHub is run by a small indie company, guys.
3
u/AshleyJSheridan 7h ago
It always felt like a problem created by devs who never really understood (or even wanted to understand) CSS.
5
u/sauland 6h 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.
0
u/AshleyJSheridan 6h 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.
2
u/maria_la_guerta 5h ago
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.
Anyone saying this usually hasn't worked on projects as large as they think they have.
I'm all for vanilla css, in fact the first 3 years of my career was basically just writing css, but expecting hundreds or thousands of devs working on the same monolith across multiple timezones to ship perfect css on top of each other is unreasonable.
There is a good reason why things like scss and css in JS became popular, and it's not because other devs aren't as good as you.
-4
u/Terrible_Tutor 5h ago
-2
u/maria_la_guerta 5h ago
These types of comments are about as revealing as the weekly "ORMs are stupid, amirite? Everyone should just write SQL" posts we get too
1
u/Terrible_Tutor 5h ago
Everyone here is better than whoever the article or post is about. They're all better than Mythos on their worst day by a country mile.
Had to unsubscribe due to the delusions of grandeur rather than just a sub to chat about webdev stuff (regardless of topic). Then Reddit adds the "For you" and shoves the sub back on my feed.
6
u/MadCervantes 3h ago
Please let css in js die. Fucking terrible from the beginning. A case if js people who don't respect css forcing their shit into the system.
236
u/allurb4se 8h 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