← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

GitHub Migrates from CSS-in-JS to CSS Modules, Reports 55% Faster SSR

🔄 Updated 22h ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • GitHub moved github.com from styled-components to CSS Modules.
  • Server-side rendering time decreased by 55%.
  • Component initialization became 25% faster.
  • Migration took three years, involving 7,760 styling usages.
  • CSS Modules provide static stylesheets, removing client/server runtime work.

Migration Details and Performance Gains

GitHub has detailed its three-year effort to transition github.com from CSS-in-JS, specifically styled-components, to CSS Modules. This migration has led to significant performance improvements, including a 55% reduction in server-side rendering (SSR) time and a 25% increase in component initialization speed within its Primer design system.

Motivation for the Change

The decision to migrate stemmed from scaling problems identified in 2023, as the number of components on certain pages grew. This growth led to increased initial page load times, server render times, and style update costs with the existing styled-components setup. CSS Modules were chosen for their ability to retain native CSS features and co-location while eliminating client and server runtime overhead, allowing styles to be delivered as static stylesheets with the HTML.

Migration Process and Challenges

The migration involved creating CSS Modules variants for every Primer component, gating them behind feature flags, and verifying visual parity before a phased rollout. The more complex part involved migrating approximately 7,760 instances of `sx` prop usages across github.com. A transitional `@primer/styled-react` package facilitated compatibility during the crossover period. A team of eight engineers migrated 6,419 props over six months, observing SSR improvements between 3% and 22% per page. The remaining 895 props were completed by two engineers in three weeks, utilizing Copilot coding agents. Decoupling theming for GitHub's seven themes and high-contrast variants was also necessary before fully removing styled-components. Internal tools like a VS Code plugin and codemods helped reduce manual effort.

Industry Context and Impact

The move aligns with broader industry trends, as styled-components has entered maintenance mode. Other developers undertaking similar migrations have reported benefits such as 30% build time speed improvements and better tree shaking in Next.js projects. However, some community members have expressed skepticism regarding the user impact, citing concerns about the readability of hashed CSS class names and potential difficulties for ad-blockers, custom CSS, and browser extensions.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~4 min · 3 stories · Nov 26

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

GitHub completed a three-year migration of github.com from CSS-in-JS (styled-components) to CSS Modules, resulting in a 55% reduction in server-side rendering time and 25% faster component initialization. This change addresses scaling issues encountered with increasing component counts and improves initial page loads by delivering static stylesheets.