3 ms·
If you are using Tailwind then your designers need to be aware of its presets and be designing with them in mind. When it comes to code reuse, either extract
by stanmancan 6y ago
If you are using Tailwind then your designers need to be aware of its presets and be designing with them in mind.
When it comes to code reuse, either extract the button to a component that you reuse, or extract it to a class in tailwind.
.btn { @apply px-4 py-2 rounded }
Now you can just add the btn class and you’re done. If you ever want to change that button you can just update it and be done. If you want a button with different padding add btn px-8 and you’re done.
If you’re using components then you just create the button in a single place and reuse it. If you have custom requirements for the button then you override it.
It’s really quite simple and easy to do everything you’re describing. I’d read the docs and watch some videos on it and start working with it instead of against it.
Or don’t use it at all, makes no difference to me!
- thirdsun 6y agoOn the surface Tailwind seems quite great and whenever I stumble upon it I like the idea of good defaults, but since I don't use React or a component-based UI framework I'd mostly work with Tailwind's @apply directive, I assume, and at that point I wonder why I shouldn't simply stick to .btn { padding: 4rem 2rem; border-radius: 2rem; } rather than .btn { @apply px-4 py-2 rounded } It simply feels like an additional, unnecessary layer and, frankly, somewhat wrong.