After reading this tweet I thought I'd write some thoughts on why I disagree with the idea that CSS is unrefactorable.
I've done this before. I've taken a huge app, with a fairly complicated Jenga tower of CSS using lots of SASS nesting and turned it into something clean and maintainable. It took time, it was difficult and it took lots of discipline, but it's doable. And yeah, this probably won't always work, but here's the approach I took.
- Start by defining guidelines and a class naming system
- How to structure files, what methodology you're using. Doesn't really matter which, but pick one.
- Every time a new use case comes along where people are not sure how to apply the methodology, talk about it and document it as a use case
- Have a styleguide
- Helps maintain visual consistency
- Helps with people not reinventing things all the time (sometimes it has to be done though)