With utility styles, your CSS stops growing

When working with traditional CSS, the first thing you do when you need to style a new page or component is to open a stylesheet and start writing new CSS.

Also when editing existing styles, sometimes you'll write new styles to avoid breaking the existing pages in unexpected ways in other parts of the page. This is why I've not seen many projects where the styling is maintained or refactored over time - only added to.

By writing new CSS for every new page or component, the size of your stylesheets will continue to grow and be less performant and harder to maintain over time.

With utility styles and frameworks like Tailwind CSS, this happens a lot less or sometimes not at all.

If you need to use a class like flex or grid and you already use that in your project, there's no new CSS to add and the stylesheet doesn't grow. Because these type of classes are so specific, they're much more reusable which means less duplication of CSS rules and less CSS in total.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.