<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku" -->

---
title: Improving site performance by shipping more CSS | daily.dev
description: GitHub's Primer design system team describes a multi-year migration from CSS-in-JS (styled-components) to CSS Modules across the entire GitHub codebase....
canonical: https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Improving site performance by shipping more CSS | daily.dev
og:description: GitHub's Primer design system team describes a multi-year migration from CSS-in-JS (styled-components) to CSS Modules across the entire GitHub codebase....
og:url: https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku
og:image: https://api.daily.dev/og/posts/Gh8jXvxKu.png
og:image:alt: Improving site performance by shipping more CSS
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Improving site performance by shipping more CSS

**[GitHub Blog](https://daily.dev/sources/ghblog)** · 9 min read · 47 upvotes · 9 comments

## Summary

GitHub's Primer design system team describes a multi-year migration from CSS-in-JS (styled-components) to CSS Modules across the entire GitHub codebase. Starting in 2023, performance issues from client/server style initialization prompted the switch. Using feature flags, visual regression tests, and gradual rollouts, Primer components were fully migrated by December 2024, yielding 55% faster server-side rendering and 25% faster component initialization. The harder task was removing the sx prop (styled-components-based styling) from thousands of GitHub UI usages, work that began April 2025 and, aided by codemods, a VS Code plugin, and later Copilot coding agents, finished by June 2026 when GitHub reached 100% CSS Modules, including decoupled theming across seven themes.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://github.blog/engineering/architecture-optimization/improving-site-performance-by-shipping-more-css>

## Questions this post answers

### What performance gains did GitHub see from migrating Primer components from CSS-in-JS to CSS Modules?

Migrating Primer's components from CSS-in-JS to CSS Modules cut server-side render time by 55% and reduced component initialization time on a page by 25%. The migration was completed across all Primer components by December 2024 using an incremental, feature-flagged rollout with visual regression testing to catch differences between the old and new styling before shipping to all users.

_Track real-world migration benchmarks like this on daily.dev before committing to a CSS architecture rewrite._

### How did GitHub remove the sx prop and styled-components from its entire codebase without breaking production?

GitHub used a package-by-package migration: sx usage was translated into CSS Modules files, styled-react wrapper imports were swapped for direct primer/react imports, then tested in pre-production before deploy. Starting April 2025 with about 7,760 sx props, a rotation of engineers plus later Copilot coding agents brought the count to zero by April 2026, with GitHub fully on CSS Modules by June 2026.

_Developers planning large dependency removals can follow migration playbooks like this one on daily.dev._

### Why did GitHub move away from styled-components for its design system?

Styled-components caused rising performance costs as component counts grew: slower initial page loads from client-side style initialization, degraded server-side rendering, and runtime costs from dynamic inline sx objects. GitHub replaced it with CSS Modules, which requires no client or server runtime and ships styles as static stylesheets, and the switch coincided with styled-components entering maintenance mode.

_Weighing CSS-in-JS versus CSS Modules for a design system is easier with real migration case studies on daily.dev._

## Community take

How the wider developer community reacted, aggregated from 2 discussions and 55 comments across lobsters, hackernews (as of 2026-09-27).

**TL;DR:** Discussion is dominated by a long, heated argument over whether GitHub's remaining CSS payload (2.1MB) is actually a performance problem, alongside skepticism that GitHub's real-world performance has improved at all, plus side debates on hashed class names and CSS-in-JS alternatives.

**Sentiment:** 15% positive · 30% mixed · 55% skeptical

**The case for**

- Some acknowledge that migrating a million-plus-line codebase off styled-components is a genuinely hard, commendable engineering effort.
- A few note that at scale, shaving bytes and optimizing assets does matter more, not less.

**The pushback**

- Several point out GitHub still ships megabytes of CSS across dozens of requests, undermining the 'performance win' framing.
- Multiple users say they haven't noticed any real-world speedup and feel GitHub pages have gotten slower, especially on large PRs/issues.
- Hashed/obfuscated CSS Modules class names are criticized as harder to debug and worse for ad blockers or custom CSS overrides.
- Some argue this kind of large-scale refactor could have been avoided with better upfront choices (e.g. vanilla-extract or not adopting CSS-in-JS in the first place).
- One commenter frames it cynically as 'ship more CSS' as a euphemism, i.e. the optimization narrative is spin.

**By community**

- lobsters (mixed): No substantive comments were provided, so no discernible take.
- hackernews (heated): A large sub-thread argues fiercely about whether shipped CSS size actually matters at GitHub's scale, alongside skepticism about real-world performance gains and debate over hashed class names.

**Hottest debate:** Whether GitHub's remaining multi-megabyte CSS payload constitutes a real performance problem or is dismissed as armchair over-optimization.

**Open questions**

- Why is GitHub still shipping over 2MB of CSS across many requests if the migration was meant to improve performance?
- Would a functional/utility-CSS approach let them shrink the CSS footprint dramatically compared to the current CSS Modules setup?
- Why do many users perceive GitHub as slower or unchanged despite the claimed 55% SSR and 25% init improvements?

**Highlights**

> 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.
> — [meerita on hackernews · 3 comments](https://news.ycombinator.com/item?id=49864260)

> The shitty team excuse. Performance is not complicated. You measure something and compare the numbers. Through my career I have encountered the following failures repeatedly: * The complete inability to measure things. This is common among people with low social intelligence. Many people in this line of work cannot measure things and form all kinds of bullshit excuses. Cannot do it all as they are disabled. Sometimes is laziness, sometimes it’s autism masking, and sometimes it’s stupidity/ignorance where they believe they shouldn’t have to or are superior from convention alone. * The shitty team argument. It’s common for people to intentionally avoid or discard measures because there is fear superior performance may indicate an operating deficit. The last thing anybody in software wants is to change approach if they are on a shitty team, because corporate developers are allergic to training people. This is often justified by asking what happens if you work on a team or about new hires. * Throwing performance data away and lying about it. This is very common when performance data provides evidence that current conventions or favorite tools harm performance. If, for example querySelectors measure 100,000 times slower than some other approaches developers will pretend the performance evidence just doesn’t exist. * Guessing. When people suck at what they do they invent their own performance realities. When people guess at software performance they are supremely wrong more than 80% of the time and tend to be wrong by multiple orders of magnitude.
> — [austin-cheney on hackernews · 3 comments](https://news.ycombinator.com/item?id=49864613)

> This sort of comment has completely lost the forest for the trees. You’re conflating scale with bloat. At large orgs the problem is that nobody is willing to step back and say “this sucks”. Trying to get this fixed involves getting 6 teams to agree upon something with no clear owner for the outcome and with everyone incentivised for not being blamed if one of the other groups tanks the effort. > engineers should drop everything and work overtime on optimising performance No, we’re asking for it to be taken seriously by the organisation. I work in games, and on large projects we usually have a small team (2/3 people of a team of 80-100) who are constantly working on this stuff. Their work is “subjective” improvements but often it’s just building tooling and telling other groups what they need to fix.
> — [maccard on hackernews · 2 comments](https://news.ycombinator.com/item?id=49865316)

> 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
> — [jenadine on hackernews · 1 comments](https://news.ycombinator.com/item?id=49865199)

> This. The only thing hashing classes achieves is making it difficult for users to use ad blockers and/or custom CSS. I understand why e.g. Meta does it on their sites, but for GitHub it makes no sense.
> — [notpushkin on hackernews](https://news.ycombinator.com/item?id=49864455)

**Source threads**

- [lobsters](https://lobste.rs/s/fli8va/improving_site_performance_by_shipping) · 1 points · 0 comments
- [hackernews](https://news.ycombinator.com/item?id=49856193) · 26 points · 55 comments

## Community discussion

Top comments from developers on daily.dev.

**@vladsiu** · 7 upvotes

> Plain CSS was always faster and better than CSS-in-JS

**@jpdelatorre** · 3 upvotes

> I'm not sure this needed to be an entire article. It took so many years to move animations and transitions from JS to CSS. It feels backwards and counterproductive to move styling to JS.

**@javidizadfar** · 3 upvotes

> Not to devalue their hard work or anything, but three years for a migration is way too long — even without AI in the picture.

**@agustinbarrientos** · 1 upvotes

> I'd block new styled-react imports as each package gets migrated. Existing imports could sit on an allowlist that only shrinks.

**@apperside** · 1 upvotes

> Catchy title, it should have been "improving performance by replacing  css in JS with plain css"

## Similar posts on daily.dev

- [Issue \#760: Why GitHub now ships more CSS, not less — Frontend Focus](https://daily.dev/posts/issue-760-why-github-now-ships-more-css-not-less-frontend-focus-oi6kowdye) · Frontend Focus · 2 upvotes · 0 comments
- [Styling Linear for the future with StyleX](https://daily.dev/posts/styling-linear-for-the-future-with-stylex-qmtpzoc4t) · Reid Burke · 59 upvotes · 4 comments
- [Linear Completes 1,000-PR Migration From styled-components to Meta's StyleX](https://daily.dev/posts/linear-completes-1-000-pr-migration-from-styled-components-to-meta-s-stylex-twjve9pqu) · InfoQ · 14 upvotes · 4 comments

---

Tags: [#react](https://daily.dev/tags/react), [#css](https://daily.dev/tags/css), [#design-systems](https://daily.dev/tags/design-systems), [#styled-components](https://daily.dev/tags/styled-components)

[View this post on daily.dev](https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Improving site performance by shipping more CSS","url":"https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku"},"datePublished":"2026-09-25T15:03:41.366Z","dateModified":"2026-09-27T14:03:42.487Z","description":"GitHub's Primer design system team describes a multi-year migration from CSS-in-JS (styled-components) to CSS Modules across the entire GitHub codebase....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1f721413896dea7a4f39894b3376c6dd?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1f721413896dea7a4f39894b3376c6dd?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"GitHub Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"GitHub Blog","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/106cf162b88840808484d4b5429b59b1","url":"https://daily.dev/sources/ghblog"},"commentCount":9,"discussionUrl":"https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":47},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":9}],"keywords":"react,css,design-systems,styled-components","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"GitHub Blog","item":"https://daily.dev/sources/ghblog"},{"@type":"ListItem","position":3,"name":"Improving site performance by shipping more CSS"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku","comment":[{"@type":"Comment","text":"Plain CSS was always faster and better than CSS-in-JS","datePublished":"2026-09-26T06:03:43.260Z","url":"https://daily.dev/posts/Gh8jXvxKu#c-hPtgB2JQM","author":{"@type":"Person","name":"Vladislav Siumbeli","url":"https://daily.dev/vladsiu","image":"https://media.daily.dev/image/upload/s--GalxSgjS--/f_auto/v1757768087/avatars/avatar_ezH33Lu6a37KM1SfsCwIx?_a=BAMClqZW0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":7}},{"@type":"Comment","text":"I’m not sure this needed to be an entire article. It took so many years to move animations and transitions from JS to CSS. It feels backwards and counterproductive to move styling to JS.","datePublished":"2026-09-26T06:15:16.180Z","url":"https://daily.dev/posts/Gh8jXvxKu#c-x3LEKBuvQ","author":{"@type":"Person","name":"JP de la Torre","url":"https://daily.dev/jpdelatorre","image":"https://media.daily.dev/image/upload/s--vMLSF3-1--/f_auto/v1787723050/avatars/avatar_0fMQQvxSIIVibBvP847Xo?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"Not to devalue their hard work or anything, but three years for a migration is way too long — even without AI in the picture.","datePublished":"2026-09-26T13:22:15.523Z","url":"https://daily.dev/posts/Gh8jXvxKu#c-FfRkLHsNK","author":{"@type":"Person","name":"Javid Izadfar","url":"https://daily.dev/javidizadfar","image":"https://lh3.googleusercontent.com/a/ACg8ocJwXn6TOW4p_MmmLmigmpQATKtnxBm1Q-zkevCt9zn2sO6G_3dn-w=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"I’d block new styled-react imports as each package gets migrated. Existing imports could sit on an allowlist that only shrinks.","datePublished":"2026-09-27T20:10:13.278Z","url":"https://daily.dev/posts/Gh8jXvxKu#c-weC9cyoyb","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Catchy title, it should have been “improving performance by replacing  css in JS with plain css”","datePublished":"2026-09-26T14:28:52.780Z","url":"https://daily.dev/posts/Gh8jXvxKu#c-xUHPWLZyX","author":{"@type":"Person","name":"Apperside","url":"https://daily.dev/apperside","image":"https://avatars.githubusercontent.com/u/5955338?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/improving-site-performance-by-shipping-more-css-gh8jxvxku#faq","mainEntity":[{"@type":"Question","name":"What performance gains did GitHub see from migrating Primer components from CSS-in-JS to CSS Modules?","acceptedAnswer":{"@type":"Answer","text":"Migrating Primer's components from CSS-in-JS to CSS Modules cut server-side render time by 55% and reduced component initialization time on a page by 25%. The migration was completed across all Primer components by December 2024 using an incremental, feature-flagged rollout with visual regression testing to catch differences between the old and new styling before shipping to all users. Track real-world migration benchmarks like this on daily.dev before committing to a CSS architecture rewrite."}},{"@type":"Question","name":"How did GitHub remove the sx prop and styled-components from its entire codebase without breaking production?","acceptedAnswer":{"@type":"Answer","text":"GitHub used a package-by-package migration: sx usage was translated into CSS Modules files, styled-react wrapper imports were swapped for direct primer/react imports, then tested in pre-production before deploy. Starting April 2025 with about 7,760 sx props, a rotation of engineers plus later Copilot coding agents brought the count to zero by April 2026, with GitHub fully on CSS Modules by June 2026. Developers planning large dependency removals can follow migration playbooks like this one on daily.dev."}},{"@type":"Question","name":"Why did GitHub move away from styled-components for its design system?","acceptedAnswer":{"@type":"Answer","text":"Styled-components caused rising performance costs as component counts grew: slower initial page loads from client-side style initialization, degraded server-side rendering, and runtime costs from dynamic inline sx objects. GitHub replaced it with CSS Modules, which requires no client or server runtime and ships styles as static stylesheets, and the switch coincided with styled-components entering maintenance mode. Weighing CSS-in-JS versus CSS Modules for a design system is easier with real migration case studies on daily.dev."}}]}
```

