Migrating a CSS codebase from ad-hoc utility classes without rewriting everything

Our CSS accumulated hundreds of tiny utility classes written ad hoc over several years. They aren't a coherent system; `mt-small`, `margin-top-2` and a dozen similar names all coexist. Rewriting every template for a new framework would be expensive and risky. I'm considering documenting a small spacing and typography scale, then replacing duplicate patterns only when touching each component. Has anyone cleaned up this kind of CSS incrementally without creating an endless transitional mess?

  • webdev
  • migrating
  • codebase
  • utility
43

5 replies · Sort: Best

Best

No conversations include a reply from the original poster.