3 | Utility-First 4 |
5 |6 | Traditionally, whenever you need to style something on the web, you write CSS. With Tailwind, you style elements by applying pre-existing classes directly in your HTML. 7 |
8 |9 | Once you've actually built something this way, you'll quickly notice some really important benefits: 10 |
11 |-
12 |
- 13 | You aren't wasting energy inventing class names. 14 | 15 |
- 16 | Your CSS stops growing. 17 | 18 |
- 19 | Making changes feels safer. 20 | 21 |
23 | When you realize how productive you can be working exclusively in HTML with predefined utility classes, working any other way will feel like torture. 24 |
25 |26 | The biggest maintainability concern when using a utility-first approach is managing commonly repeated utility combinations. This is easily solved by extracting components, either as template partials/JavaScript components, or using Tailwind's @apply feature to create abstractions around common utility patterns. 27 |
28 |29 | Aside from that, maintaining a utility-first CSS project turns out to be a lot easier than maintaining a large CSS codebase, simply because HTML is so much easier to maintain than CSS. Large companies like GitHub, Heroku, Kickstarter, Twitch, Segment, and more are using this approach with great success. 30 |
31 |