3 ms·
Absolutes are the problem. DaisyUI gives the flexibility of using Tailwind directly or higher level classes. Tailwind is great but sometimes you end up having
by manquer 5y ago
Absolutes are the problem. DaisyUI gives the flexibility of using Tailwind directly or higher level classes.
Tailwind is great but sometimes you end up having 10-15+ classes for basic components that makes the code harder to read and reason with.
We should have utility classes and composability, but relying on them exclusively is also not necessarily the best way either.
- azemetre 5y agoCan't you just use @apply to make a single uniform style that utilizes all those classes? That's my understanding at least, like if you want to make a button, instead of have the same 10+ classes posted everywhere you make a new class with @apply and keep the styles uniform. Then in the future if you need to change one of the core utilities it's also easily updated to all you the @apply classes you make. Am I misunderstanding the purpose? I've only used tailwind twice.
- manquer 5y agoyes you can use @apply. DaisyUI also supports @apply directives as well both for their own and tailwind clases. However you have to use them yourself. With vanilla Tailwind there is no out of the box @apply directives already set you can use. Think of DaisyUI as basically a whole set of @applies someone already made for you. For users new to frameworks with utility focus it can be less steep learning curve to experiment and all the out of the box abstractions can reduce the need for having your own.
- ratww 5y agoTailwind is supposed to be used with components. Often it's React/Vue/Web components, but CSS components with @apply, like you're doing, also work perfectly fine.