GitHub finishes multi-year migration off CSS-in-JS to CSS Modules

GitHub has finished migrating github.com off CSS-in-JS and onto CSS Modules, according to a blog post by Primer design system engineers Josh Black and Marie Lucca published September 25, 2026. The project started back in 2023, when the number of components on certain pages began to grow and the team's existing CSS-in-JS setup (styled-components) started causing client and server performance problems. The Primer team settled on CSS Modules, which lets styles be authored as native CSS colocated with each component's JavaScript, avoids any client or server runtime cost, and rolls styles up into stylesheets shipped with the page HTML.

The migration ran in stages so it would not break GitHub along the way. First, the Primer team converted its own components to CSS Modules one at a time, using feature flags to test each change in production before rolling it out. By December 2024, every Primer component had been migrated, and the team measured 55% less time to server-side render a page and 25% less time for components on a page to initialize.

The harder part was GitHub's use of the "sx" prop, a Primer feature that let any team inject inline style objects into components, which the authors describe as "the best and worst parts of CSS-in-JS." Removing CSS-in-JS from Primer itself did not remove sx from the wider GitHub codebase, which still relied on it as its de facto styling standard. To keep things working during the transition, the team built a transitional "@primer/styled-react" wrapper library so code using sx could keep functioning while newly migrated components could still be imported directly for the performance gains. The sx-elimination effort kicked off in April 2025 with a peak of about 7,760 props to migrate. An in-house engineer, Ian Sanders, built a VS Code plugin to help migrate props one at a time, and an internal codemod automated migration of whole files. Over the following six months, a rotating team of eight engineers migrated 6,419 of those props, seeing server-side rendering gains ranging from 1% up to 22% on some pages. Notably, styled-components itself was announced to be entering maintenance mode around this time, which the authors took as confirmation they were on the right track.

Work on the remaining props paused while GitHub's engineering attention shifted toward Copilot features such as the coding agent and code review. When the team returned to the task in April 2026, only 895 sx props were left, and a team of just two engineers, aided by Copilot coding agents, eliminated all of them within three weeks. That cleared the way for removing styled-components as a dependency, except for one remaining use: theming. GitHub supports seven different themes, each with a high-contrast variant, all previously wired up through styled-components utilities. Because the underlying theme variables were already defined in CSS via the @primer/css package, decoupling the JavaScript theming layer took about two months of further migration, rollout and feature-flagging work. As of June 2026, GitHub has been running entirely on CSS Modules, with sx, styled-components and styled-system fully removed from the product.

Key facts

  • Primer's own components were fully migrated from CSS-in-JS to CSS Modules by December 2024, cutting server-side render time by 55% and component initialization time by 25%.
  • Eliminating the "sx" styling prop from the wider GitHub codebase started in April 2025 with a peak of about 7,760 props; a rotating team of 8 engineers migrated 6,419 of them over six months, gaining 1% to 22% in server-side rendering speed on some pages.
  • In April 2026, a two-engineer team finished the remaining 895 sx props in three weeks, aided by an internal VS Code plugin built by engineer Ian Sanders and by Copilot coding agents.
  • Decoupling GitHub's theming system, which supports seven themes each with a high-contrast variant, took about two more months before styled-components dependencies could be removed.
  • GitHub has run entirely on CSS Modules since June 2026, with sx, styled-components and styled-system fully removed from github.com.

Why it matters

This is a concrete, measured example of moving a large, actively-shipping production codebase off CSS-in-JS, a pattern many teams adopted years ago and are now reconsidering for its runtime cost. GitHub reports real performance wins (55% faster server-side rendering, 25% faster component initialization after the first phase alone) rather than theoretical ones, and the timing lines up with styled-components itself entering maintenance mode.

Who it affects

Directly, GitHub's own engineering org and the Primer design system team, whose components and internal libraries changed shape across the migration. Indirectly, github.com's users benefit from faster page loads, and any team running a large CSS-in-JS codebase, particularly one built on styled-components, gets a real-world data point for planning a similar move.

How to use it

The post lays out the sequence GitHub followed: migrate the design system's own components to CSS Modules first behind feature flags, build a transitional wrapper library (@primer/styled-react) so legacy code using the old styling prop keeps working, then grind down remaining usages with a mix of manual work, an in-house VS Code plugin, and codemods, and only decouple theming last since it was the final dependency on the old system.

How solid is it

This is a first-party account from two GitHub Primer engineers, Josh Black and Marie Lucca, published on GitHub's own engineering blog with specific figures throughout (percentages, prop counts, engineer counts, and dates for each phase). It is a self-reported case study rather than an independently audited benchmark.

Risks and caveats

The post does not say how many total engineers or teams worked on the migration beyond the specific 8-engineer and 2-engineer rotations it names, and it gives no specific performance numbers for the theming-decoupling phase itself, only its two-month timeline. The team also notes the process had 'a few hiccups along the way,' and the effort spanned multiple years with a mid-project pause while attention shifted to other GitHub Copilot work.