GitHub moved github.com off CSS-in-JS to CSS Modules over three years, citing 55% faster SSR and 25% faster component init, per InfoQ.
Key Takeaways
- GitHub cut server-side rendering time 55% after a three-year migration from CSS-in-JS to CSS Modules, per InfoQ.
- Component initialisation across GitHub's Primer design system improved 25% post-migration.
- The project involved converting roughly 7,760 sx prop usages across github.com.
- Two engineers cleared the final 895 props in three weeks using Copilot coding agents, versus six months for the prior 6,419.
- Primer, GitHub's open-source component library, was fully on CSS Modules by December 2024.
GitHub has finished a three-year migration of github.com away from CSS-in-JS and onto CSS Modules, reporting a 55% reduction in server-side rendering time and a 25% improvement in component initialisation across its Primer design system, according to InfoQ. The project, detailed in a post by Primer engineers Josh Black and Marie Lucca, traces how ballooning component counts on certain pages exposed scaling limits in GitHub's existing styled-components setup.
What Happened
According to InfoQ, the trouble began in 2023 when initial page loads, server render times and style update costs all started climbing in proportion to component count on github.com. The Primer team chose CSS Modules over continuing with runtime CSS-in-JS because it preserved native CSS features and co-location while eliminating client and server runtime work, letting styles compile into static stylesheets shipped alongside the HTML.
The rollout followed a staged pattern familiar to platform migrations: each Primer component got a CSS Modules variant, gated behind a feature flag, checked against visual regression tests, then released first to the Primer team, then to GitHub staff, then to all users. InfoQ reports that by December 2024, Primer itself was fully converted. The harder phase involved the roughly 7,760 uses of the sx prop scattered across github.com, which had served as the de facto styling standard for years. A transitional package called @primer/styled-react kept sx functioning against already-migrated components during the crossover period.
InfoQ's account describes a rotating team of eight engineers migrating 6,419 of those props over six months, with SSR gains on individual pages ranging from 3% to 22%. The remaining 895 props were cleared in three weeks by just two engineers who relied heavily on Copilot coding agents to automate the conversions. GitHub also had to decouple theming logic across seven themes and high-contrast variants before it could remove styled-components entirely, using an internal codemod and a VS Code plugin to cut the manual workload. The company noted that styled-components entering maintenance mode reinforced its decision to move on.
InfoQ also surfaced reaction on Hacker News: one commenter running a similar migration on a codebase over one million lines reported a 30% build time improvement and better tree shaking on Next.js, while others pushed back, arguing the size reduction doesn't justify hashed, unreadable class names that complicate ad-blockers, custom CSS and browser extensions. A separate thread pointed out that CSS-in-JS can be made zero-runtime without switching to Modules at all.
Why It Matters
GitHub's migration is a platform story as much as a performance one. The Primer Design System is GitHub's open-source component library, and by publishing the full three-year path, including the transitional @primer/styled-react package, the VS Code plugin and the codemod, GitHub has effectively handed other teams a migration API playbook rather than just a blog post. InfoQ notes that Linear recently completed its own 1,000-PR move from styled-components to Meta's atomic StyleX library after upgrading to React 18's concurrent mode, and that teams using vanilla-extract or Tailwind have already pushed style generation to build time entirely. The pattern across all of these is the same: pay the styling cost once at build, not on every request, which matters more as component counts and server-rendered surface area grow. For companies evaluating which frontend stack to standardise on, and for investors weighing the equity implications of AI developer tool adoption inside large engineering orgs, the detail that Copilot agents cleared the final 895 sx props in three weeks versus six months for the bulk of the work is a concrete data point on where agentic coding tools are already load-bearing in production migrations, not just prototyping.
What to Watch
The open question is whether GitHub's public migration guide, including the Primer React v38 release notes and its CSS variables migration documentation, becomes a reference path other large React codebases follow, the way Linear's StyleX move has already become a comparison point. Watch whether more teams report similar SSR gains after adopting CSS Modules or StyleX, and whether the Hacker News skepticism about hashed class names breaking ad-blockers and browser extensions turns into a broader pushback against build-time CSS tooling. It's also worth tracking how much of the final-mile migration work at other companies gets handed to coding agents rather than engineering headcount, given GitHub's own two-engineer, three-week finish on the last 895 props.
Further reading and context
For more on how AI coding tools like Copilot are reshaping engineering workflows, see MachineHours' guide to AI coding tools and the transformation of software development and the analysis of how AI coding has gone mainstream inside enterprise teams.
Key Facts
- GitHub reports a 55% reduction in server-side rendering time after moving github.com off CSS-in-JS onto CSS Modules
- Component initialisation across the Primer design system improved 25%
- The migration addressed roughly 7,760 sx prop usages; 6,419 were converted by eight engineers over six months, the final 895 by two engineers in three weeks using Copilot coding agents
- Primer itself was fully migrated to CSS Modules by December 2024, per InfoQ
Further reading and context
Sources
- InfoQ: GitHub Ditches CSS-in-JS for CSS Modules, Reports 55% Faster SSR After Three-Year Migration
- MachineHours Encyclopedia: AI Coding Tools — Cursor, GitHub Copilot, and the Transformation of Software Development
- MachineHours Encyclopedia: AI Coding Goes Mainstream
- MachineHours: AI & Robotics Acceleration Index
- The $500 Billion Data Centre Build — Will the Capex Pay Off?
- Boston Dynamics vs Figure vs Agility Robotics — Humanoid Robots in 2026
Frequently Asked Questions
Why did GitHub move away from CSS-in-JS?
InfoQ reports that component counts on certain github.com pages exploded starting in 2023, exposing scaling problems in the styled-components setup, with initial page loads, server render times and style update costs all growing alongside component count.
What performance gains did GitHub report?
GitHub reported a 55% reduction in server-side rendering time and a 25% improvement in component initialisation across its Primer-powered design system, according to InfoQ.
How long did the migration take and who worked on it?
The migration took about three years. A rotating team of eight engineers converted 6,419 of roughly 7,760 sx prop usages over six months, and two engineers cleared the final 895 in three weeks using Copilot coding agents, per InfoQ.
Is GitHub the only company making this kind of move?
No. InfoQ notes that Linear recently completed a 1,000-PR migration from styled-components to Meta's StyleX library, and other teams have shifted to vanilla-extract or Tailwind to move style generation to build time.
What tools did GitHub use to ease the migration?
GitHub built a transitional @primer/styled-react package to keep the sx prop working during the crossover, along with an internal codemod and a VS Code plugin to reduce manual conversion work, according to InfoQ.
Get MachineHours in your inbox
AI compute and the machine economy in your inbox.
