practicegithub.blog ↗

Improving site performance by shipping more CSS

GitHub cut server-side render time 55% by leaving CSS-in-JS: 6,419 sx props removed, every switch behind a flag and rolled out to the team, then staff, then everyone.

The GitHub Blog · · 8m read

A green isometric cube bearing the GitHub Octocat, set against a grid of green squares on a pale gradient

Why we picked it · the editor's summary

GitHub's Primer team replaced CSS-in-JS with CSS Modules and reports 55% less server-side rendering time and 25% faster component initialization. The components moved first: CSS Modules files sat beside the old styles behind a feature flag, visual regression snapshots had to match, and each switch went to the team, then staff, then all users. The long tail was about 7,760 sx props at peak, worked down by a rotation of eight engineers over six months with a codemod and a VS Code plugin, later with Copilot coding agents, until styled-components was gone. If a migration of yours is stuck at 80%, copy the transitional wrapper library they built for the middle state.

Read on The GitHub Blog ↗

Comments

Loading comments…