Hacker News new | ask | show | jobs
by doctoboggan 326 days ago
> Can you just apply it to `button { @apply flex items-center blahblahblah; }` in app.css? Of course you can.

I tried using tailwind a few years ago and I think this was explicitly recommended against, at least at that time.

2 comments

The docs up through version 3.x explicitly called this out as not recommended and a poor choice, but the justifications were... sort of lame. "You'll have to come up with class names, your css bundle might be bigger, etc". I did read a more technical github issue on @apply vs theme() which called out the apply behaviour as doing a bit more than expected. I don't recall 'theme' being a thing in earlier tailwind versions, but I'm not an expert at it, so I might have missed that.
IIRC the creator of tailwind might have been against @apply too, but it didn't seem like a good recommendation to me
@apply to me I only use if I have no other choice, such as if I need to build a CSS file that needs to have classes with specific names. (Such as giving our company styling to a third party service).