GitHub ditches CSS-in-JS and gets 55% faster server-side rendering

Improving site performance by shipping more CSS

GitHub ditches CSS-in-JS and gets 55% faster server-side rendering

GitHub migrated github.com from CSS-in-JS to CSS Modules, cutting server-side rendering time by 55% and component initialization by 25%. The incremental rollout used feature flags and visual regression tests. After migrating Primer components, the team removed 7,760 sx props and eliminated styled-components, finishing in June 2026 without breaking the site.

What looked at first like a CSS migration turned out to be a gradual re-platforming of how GitHub styles, themes, and ships UI at scale.
  1. meerita

    I don't know how they perceive the performance. I see 41 network requests. That's 2.1 MB of CSS over the wire, blocking rendering and hurting painting and loading speed. There's 400 KB of Tailwind, 87 KB of general CSS, plus another 200 KB of other general CSS. They need to embrace functional CSS properly. I'm sure they could have a single CSS file under 80 KB that renders everything.

  2. jenadine

    Using GitHub everyday, I haven't really noticed an improved performance. Actually i'd say pages are becoming slower. Browsing issues with many comments or big PR has a terrible experience as not everything gets loaded

  3. efortis

    There's room for improvement still. Currently, the production build is using long-dev class names. e.g. `DirectoryContent-module__Box_3__gl6dE` could be compiled to a shorter hash like `gl6DE3a2`.

    If you use Vite:

    css: {

    modules: {

    generateScopedName: mode === 'production'

    ? '[hash:base64:8]'

    : '[name]__[local]___[hash:base64:5]',

    }

    }

  4. eviks

    Unfortunately the original blog post introducing the great CSS-in-JS system being removed is not in the "Related posts" section, would be nice to compare the thinking in the two

  5. Gualdrapo

    Once (like a year ago or so) stumbled upon some person's post asking for someone to help them to "fix" some section at their website. It was done !important over !important over !important over !important. Said person was really convinced all it needed was another bunch of !important because apparently that was what ai spit for them, at least at that time

More from this day

2026-09-27