Tailwind - own components - yes or no?
i have started with tailwindcss yesterday the first time and must say - wow!
but something is confusing me from the beginning. in tutorials/videos etc. everybody talk about: do not write your own css-file, just put the whole styling into view-pages. but why - it is not DRY? for a style that is used one time (e.g. body bg-grey-100) or even a couple of times in layout templates etc. it makes sense to handle style in the views.
all the styles i am using throughout the entire app (such as buttons, links, cards etc.) i will "outsource" to the css-file (@apply).
- reusable
- cleaner code in views (better reading)
- faster changes
- DRY
i am on the right way with this? or is there another approach behind "no own css components"?
thanks for your thoughts - stay safe.
Adam talks about this in one of the Tailwind videos. I'll let him explain it cuz he can do a better job than me. https://twitter.com/adamwathan/status/1245883595396386816
Bruno, have you had a chance to look at ViewComponent? https://github.com/github/view_component Might be useful to pair with tailwind classes (and possibly extract @apply utilities) if you don’t want to start using Vue/React/etc.
@Ricky thanks for this input. i already have started to use more Vue including components / slots.