I've only started using Tailwind specifically in the last year or so, but I've been using functional CSS for about 6 years.
I don't believe using @apply is a maintainable approach. A better approach is to use view templates. In fact Adam Wathan recommends this way too in this video https://youtu.be/J_7_mnFSLDg
I wonder if they can bypass compilation in development mode somehow.
What does this mean?
.card { @apply flex flex-row shadow rounded-md p-4; @screen md { @apply flex-col p-6; } yada... yada... }
then in tailwind config, point the purge path to your html file(s) to purge.
End result is css file with no more and no less than what you need, and in the web inspector you see clean HTML markup and clean CSS declarations.
edit: typo
- you can copy the classes from html directly into @apply (you need to tinker a bit more to get responsive/hover/etc classes to work, though)
- you work with predefined values, so if you switch color in tailwind.config.js, it's gonna get correct value in the @apply class too.
That's the way I see it
But this way you have to write couple of classes more, couple of variables more. And with Tailwind you just define/change value in the config and you have all the classes generated, so the changes are minimal.
plus, it's mostly made to be used with vue/react components which should be small standalone units.
I'm personally looking forward to building websites since using tailwind after a long time
Think of tailwind as a framework for all your styling needs while sass is more a functional language to generate CSS for you.
It's like buy Ikea furniture and assembling it vs. having your own woodworking shop to handcraft furniture with precise requirements. These frameworks have made me lazy. I think CSS design is pretty much exactly the same as any craftsmanship job - there is so much pleasure from building it from the ground up. No, I still get the knots in the wood out by using reset.css.
Also, I try to not use class selectors as much as possible. HTML looks sterile and spartan with only a handful of span tags or id tags for very specialized targetted changes.
I can see why people use frameworks - its fast and quick. But you lose personality in the outcome.
That is supported by 0% of browsers? Or am I missing something?
.btn-blue {
@apply py-2 px-5 flex items-center bg-blue-500 text-white rounded
}
So I don't really see that as a problem. You are supposed to refactor your styles later to be more reusable. What tailwind provides is fast iteration and design. I love that.