CSS has always been composable through the cascade, allowing developers to combine classes and styles naturally. While utility frameworks like Tailwind promote composition, traditional CSS approaches like combining classes or using Sass mixins are equally valid forms of composition. The author argues that CSS composition extends beyond just adding classes in HTML and proposes organizing styles into four categories: layouts, typography, theming, and effects. Rather than focusing on reducing CSS or HTML bloat, developers should prioritize code architecture, structure, and clarity for better maintainability.

Table of contents
It’s not a new conceptDevelopers take a pretty narrow view of compositionComposition doesn’t reduce bloatHTML bloat and CSS bloat are probably the least of your concernsAdvanced compositionsWrapping up11 Comments
Sort: