
This content was generated with the help of AI and published without prior human review. It may contain errors and is not professional advice. Report a problem: info@delionsoft.com.
GitHub has published an account of how it moved github.com off CSS-in-JS entirely, finishing in June 2026. The work began in the Primer design system, spread to thousands of inline style props across the product codebase, and ended with the removal of styled-components and styled-system. The interesting part is less the destination than the migration method: feature flags, visual regression tests and a wrapper package that kept the old API alive while the new one shipped.
What happened
According to the original report, by 2023 pages with many components were paying a visible price for runtime styling: slower initial loads, slower server-side rendering as style collection moved to the server, and style updates that scaled badly with component count. Primer's team chose CSS Modules — styles authored in a plain CSS file next to the component, class names local by default, no client or server runtime.
The rollout was incremental. Each component got a parallel CSS Modules file, a feature flag toggling between old and new styles, and existing visual regression snapshots as the correctness check. The flag was opened first to the team, then to staff, then to all users. All Primer components were migrated by December 2024, with a reported 55% reduction in server-side render time and 25% less component initialisation time.
The harder half was the product codebase. GitHub's sx prop had been the default styling mechanism for years; the peak count was around 7,760 instances. A transitional package, @primer/styled-react, let existing call sites keep using sx while migrated code imported the fast path directly. A VS Code plugin and an internal codemod handled most of the mechanical work; a rotation of eight engineers converted 6,419 props over six months, with per-page SSR gains reported between 1% and 22%. The last 895 were cleared in three weeks in April 2026 by two engineers using coding agents. Theming — seven themes plus high-contrast variants — still depended on styled-components and took another two months to decouple, also behind a flag.
Why it matters
Most SMB teams will never have 7,760 of anything. But the shape of the problem is common: a styling approach chosen for developer ergonomics that turns into a runtime cost once page complexity grows, and that cannot be swapped out in a single release. GitHub's answer — a compatibility shim plus flags plus snapshot tests — is the standard way to replace load-bearing infrastructure without a freeze, and it is affordable at smaller scale too.
There is also a sourcing signal here. The report notes that styled-components entered maintenance mode while the migration was underway. Dependencies at the centre of your rendering path deserve periodic checks on their maintenance status, not just their CVE feed.
What to do
- Measure before choosing sides. Look at server render time and time-to-interactive on your heaviest pages, and check how much of it is style computation rather than data fetching.
- If you are considering a similar change, build the escape hatch first: a wrapper that preserves the old API lets you migrate call sites at your own pace instead of in one risky release.
- Lean on visual regression snapshots as the acceptance criterion. Pixel-identical output is a far cheaper check than manual review across hundreds of components.
- Audit your frontend dependencies for maintenance status once or twice a year, and note which ones sit in the rendering critical path.
