Hacker News new | past | comments | ask | show | jobs | submit login

for balance - i wrote Why Tailwind CSS a while ago: https://www.swyx.io/why-tailwind/

Here are my responses to OP's arguments:

1. Tailwind Makes Your Code Difficult to Read

true, there is a learning curve. But this is over relatively quickly once you learn that "w" stands for "width" and "h" is for "height", and the screen size prefixes map as you would expect from default to medium to large.

as for scanning left to right... the enter key is right there. my VSCode autoformats the classes to break lines just fine. its probably the tailwind plugin doing that.

2. Tailwind Is Vendor Lock-in

first of all, "vendor lock-in is bad" is a poor kneejerk reaction. we all buy in to vendors at some point. eg with frontend frameworks. and as far as vendor lockin goes, Tailwind is extremely light - if you want to stop using it, freeze the generated output, and then continue writing css in whatever new way you choose. this is far LESS vendor lockin than alternatives like styled components and css modules, which force you to make specific js and build tool choices. and all of these are open source so this again is an order of magnitude less lockin than anything proprietary, which is where this argument really starts being at all useful.

3. Tailwind Is Bloated

how is declaring things on the docs indicative that "its creators have tried their very best to hide this fact from you."? they've just decided on sensible defaults. the bloat only impacts development and builds. This contrasts to the problem that utility css solves, which is bloat inside of hard-to-maintain append-only CSS with lots of duplicates, which actually affects users.

4. Tailwind Is an Unnecessary Abstraction

components. use components to repeat stuff. this rant on @apply takes things way overreacts, calm down.

5. Semantics Is Important. Tailwind Forgoes It.

counterpoint: naming things is hard. Tailwind names css utilities for you so that you don't have to come up with custom names for every component.

6. Tailwind and Dev Tools Don’t Play Nicely

au contraire, tailwind plays VERY well with devtools. https://twitter.com/swyx/status/1265745431448838144?lang=bg (since this video I even learned that you can type in the classname box in chrome devtools and it autocompletes nicely for you

7. Tailwind Is Still Missing Some Key Features

then write regular css :)




> my VSCode autoformats the classes to break lines just fine.

My only pain point with Tailwind was the order of classes. It helps with readability if the classes are always in the same order. I just discovered that eslint-plugin-tailwind [0] is solving this exactly. Configuring VSCode to run code formatter and perform ESLint fixes [1] is just an incredible DX.

[0] https://github.com/Idered/eslint-plugin-tailwind

[1] settings.json: "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true }




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: