architecture3 min read

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

4 similar posts
  • styled-components
  • CSS Modules
  • Primer Design System
  • GitHub Copilot
  • StyleX
  • Next.js

AI Summary

GitHub reports a 55% reduction in server-side rendering time and 25% faster component initialization after completing a three-year migration from CSS-in-JS to CSS Modules. Written by Primer engineers Josh Black and Marie Lucca, the report details how scaling problems with styled-components led the team to adopt CSS Modules to eliminate runtime overhead. The migration involved systematically swapping out thousands of sx prop usages using feature flags, transitional packages, codemods, and AI coding agents. This transition reflects a broader industry movement away from runtime CSS-in-JS toward build-time static stylesheets.

Key Takeaways

  • GitHub achieved a 55% reduction in server-side rendering time.
  • The migration removed styled-components in favor of static stylesheets.
  • AI coding agents helped accelerate the final phase of prop migration.

Why it matters

Understanding large-scale architectural migrations helps engineering teams evaluate the performance trade-offs between runtime CSS-in-JS and build-time CSS Modules, especially regarding server-side rendering efficiency.

Conversation0

What would you add from your experience?

Checking your session…

Every good conversation starts with one perspective.