I feel that recommending @apply directives for building all the styles is missing much of the point of Tailwind. Aside from constraining you to a theme to enforce consistency, that approach offers little advantage over vanilla CSS.
Where Tailwind shines is allowing for simple maintenance of styles self-contained within a component, without the need to hunt for it within a separate CSS file. Additionally, using the utility classes helps avoid unintended cascade or specificity issues.
I use @apply sparingly in my projects, reserving it primarily for styles frequently repeated in different places across the project, like a button. For something like a card in this post's example, I would almost always create a Card component and use Tailwind classes to style it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I feel that recommending
@apply
directives for building all the styles is missing much of the point of Tailwind. Aside from constraining you to a theme to enforce consistency, that approach offers little advantage over vanilla CSS.Where Tailwind shines is allowing for simple maintenance of styles self-contained within a component, without the need to hunt for it within a separate CSS file. Additionally, using the utility classes helps avoid unintended cascade or specificity issues.
I use
@apply
sparingly in my projects, reserving it primarily for styles frequently repeated in different places across the project, like a button. For something like a card in this post's example, I would almost always create a Card component and use Tailwind classes to style it.