How we fully migrated github.com away from CSS-in-JS.
72 comments
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.
Indeed, you need to waste a few years hurting user experience before investing a few years into migration and writing another "improved performance" blog post.
> that engineers should drop everything and work overtime on optimizing performance
The opposite, they should work less instead of more doing a worse job that results in scraping all their output later in a redesign
It is in fact really really really hard to keep things lean and performant over time as you support a more complex multi-purpose web app, but you still have to try. If you try hard enough - especially now in the age of pretty good agents - you can actually thread all of the different needles and keep (perceived and actual) latency low.
sourcehut's 128kb raw, and 28kb over the wire.
codeberg is 420kb raw, and 66kb over the wire.
2MB of CSS just sounds insane. What are we even doing here?
FFS, why not just go back to explicitly inlining all the formatting in the HTML itself? I have trouble believing all the CSS is actively used. It’s not like any of this is written by humans these days.
2MB of text - isn’t that roughly half the size of the Christian Bible?
One weird tangentially related thing is checking whether a PR is merge:able after solving a conflict in this repo[1] for some reason takes several minutes. Maybe because there are 1000 commits in the same file. Doesn't seem UI related but weird regardless.
[1] https://github.com/MarginaliaSearch/submit-site-to-marginali...
The emojis I had at the beginning of the list name don't render anymore (they show up as :eyesore_emoji_name: instead) and the list is sorted alphabetically now instead of by last modified. Also it's one looong list instead of a small scroll-able container like it used to be.
This is on Firefox btw. Now I'm seriously thinking about moving these GitHub "bookmarks" into a separate place like a bookmark manager even if I lose a bit of convenience.
If you use Vite:
css: {
modules: {
generateScopedName: mode === 'production'
? '[hash:base64:8]'
: '[name]__[local]___[hash:base64:5]',
}
} 53K _long.css
38K _short.css
11K _long.css.br
8.9K _short.css.br
Both, dev and prod, have hashes because that's part of what CSS Modules uses to avoid collisions.Besides download size, smaller names improve parsing speed too.
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.
Read the full thread on Hacker News →
Related stories
- Lobsters · 8 points · 4 days ago
- Hacker News · 2 points · 7 days ago
- shadow-css: CSS-in-CLJ(S)github.comLobsters · 3 points · about 4 years ago
- DEV Community · 17 points · 10 days ago
- Hacker News · 4 points · 8 days ago
- Grimoire CSS - flexible utility class toolgrimoirecss.comLobsters · 10 points · about 1 year ago