Improving site performance by shipping more CSS
Sep 25, 2026Josh Black, Marie Lucca

Summary
This post details the migration of GitHub's frontend styling from CSS-in-JS solutions (like styled-components and the `sx` prop) to CSS Modules. It outlines a phased approach: first migrating the Primer Design System components, then systematically reducing `sx` prop usage across the codebase, and finally decoupling theming logic. The post highlights the performance gains achieved, including a 55% reduction in server-side render time and a 25% reduction in component initialization time, and details the use of feature flags, visual regression tests, and automated tooling (VS Code plugins, codemods) for a safe and gradual migration. It also notes the eventual removal of `styled-components` and `styled-system` dependencies.