DEV Community

Discussion on: What are your thoughts on Tailwind CSS?

peerreynders profile image
peerreynders • Edited on

Some more skeptical opinions about Tailwind CSS in particular or functional CSS in general:
The perils of functional CSS
I Tried Functional CSS and It Kinda Sucked
Thoughts on Tailwind CSS
Thoughts about Utility-First CSS Frameworks
Utility First and CSS Components: a reconciliation
Dave Shea (CSS Zen Garden) on Tachyons
Jeffrey Zeldman: Kiss My Classname

Also Adam Wathan points out in
CSS Utility Classes and "Separation of Concerns".

I still think there are a lot of use cases where it's more practical to create a CSS component ...but build them using utilities first

Aside: Jeremy Keith's response to that article

Extracting CSS components with @apply

Given that most people use Tailwind CSS with some kind of JS component framework or templating system they never see the need to "extract CSS components". Also the notion that CSS components only exist to eliminate duplication is restrictive - "descriptive and meaningful names" on class selectors serve to communicate (to the future developer) the intent behind applying that particular set of CSS properties. Style-centric class names only inform how an element should be styled rather than why the styles are being applied. CSS is a declarative language (IF this selector matches THEN apply these property values) - in my mind style-centric class selectors make it appear more imperative (which may contribute to the popularity of functional CSS/Tailwind CSS).

A Sass mixin could already do what Tailwind's @apply does:
When to use @extend; when to use a mixin

The need for Purgable HTML makes the class attribute values even more verbose (unless you are willing to manually manage selector exceptions).

In response to the seemingly indiscriminate popularity of Tailwind CSS Andy Bell published his CUBE CSS methodology (tutorial) supported by the Gorko utility class generator.