This article discusses Tailwind CSS and the often-overlooked @apply feature, which allows developers to integrate Tailwind's utility classes directly into their custom CSS. While this feature is typically dismissed due to its common example of single-property utilities, the author argues that it resembles the mixins seen in Sass, offering significant potential benefits for maintainability and performance. Despite creator Adam Wathan's criticism of @apply, the author believes that it serves as a useful tool for those intimidated by long class lists, advocating for a more nuanced perspective on its application.
Tailwind's @apply feature lets you apply Tailwind utility classes directly into your CSS, enabling better maintainability and performance, although it's often misunderstood and underutilized.
Many often overlook the utility of @apply because it is typically showcased using single-property utilities, which makes it seem less effective. However, it has deeper potential.
While Adam Wathan, the creator of Tailwind, advises against using @apply, I believe it holds merit similar to Sass's mixins, enhancing code maintainability.
Fundamentally, @apply exists as a bridge for those hesitant about long class lists in HTML. It offers a different perspective on how we can leverage Tailwind.
Collection
[
|
...
]