How do you structure CSS in a large project?

Chloe Martin Chloe Martin 2 weeks ago Resolved

Our stylesheet is 6,000 lines and every change breaks something. Do you use layers, BEM, utility classes? What actually worked for you?

0 Reply

Plus one to this. Count me in.

Have you tried breaking it into smaller pieces first?

This is brilliant work. How long did it take?

I disagree a little: in my experience it depends on the team size.

Saving this thread for later.

Happy to help if you want to pair on it.

Use cascade layers for the big buckets (reset, base, components, utilities) and keep component styles next to the component. It took us a sprint to migrate and the breakages stopped.