Why our CSS got smaller when the team got bigger
Priya Raman
Frontend Engineer · Pune
- Feb 17, 2025
- 2 min read
- 9
Utility layers, strict tokens, and a review habit that pruned dead rules. Good frontend engineering in a design system mostly looks like removing things.
The component that started it
The token build runs on every merge and publishes a versioned package. Nobody has to remember to run it, which is the only kind of build step that survives a busy quarter.
- Let components respond to their container
- Version the token package on every merge
- Prefer visual checks over markup snapshots
- Delete dead CSS every sprint
Testing what the user sees
We replaced most snapshot tests with a handful of visual checks at three container widths. Failures now show a picture of the problem instead of a two-hundred-line diff of class names.
The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.
Tim Berners-Lee
@container card (min-width: 32rem) {
.card { grid-template-columns: 2fr 3fr; }
}
/* the card decides, not the viewport */
Numbers after three months
Moving decisions from JavaScript into CSS made the components easier to reason about. The stylesheet now owns layout, and the script owns behaviour, which sounds obvious until you count how often we had crossed that line.
The card component had four layout props and eleven media queries. Rewriting it with container queries left one prop and three rules, and the tests finally described what the card did instead of which breakpoint it was in.
None of this is finished. We will keep adjusting as the product changes, and we will write it down here when something breaks in an interesting way.
Found this useful?
About the author
Priya Raman
Frontend Engineer · Pune
Priya builds the component library and the token pipeline behind it. She is happiest deleting CSS and writing small tools that make reviews shorter.
Tomasz Nowak
Feb 27, 2025Did you measure anything before and after? I would love to show numbers to our leadership.
Sofia Rossi
Author's pick Mar 1, 2025We shipped the same fix last month. Nice to know we were not the only ones fighting it.
Zara Ahmed
Mar 5, 2025Would love a follow-up on how the team felt about the change after six months.
Priya Raman
Author Mar 6, 2025Roughly six weeks, most of it spent on communication rather than code.
Femi Adebayo
Mar 7, 2025Our accessibility audit flagged exactly this. Sharing with the rest of the team now.
Kwame Mensah
Mar 8, 2025Really clear write-up. The list in the middle is going straight into our onboarding doc.
Oliver Grant
Mar 9, 2025This is a great point. We ran into the same wall.
Priya Raman
Author Mar 11, 2025Roughly six weeks, most of it spent on communication rather than code.
Zara Ahmed
Mar 8, 2025Really clear write-up. The list in the middle is going straight into our onboarding doc.