@ryan17stehle
Posted
I'm certainly no expert in Tailwind CSS, but I don't think it's considered a best practice to use the @apply keyword the way you've chosen to. Even their own documentation says to use @apply sparingly. You can read about it here: https://tailwindcss.com/docs/reusing-styles#extracting-classes-with-apply
Marked as helpful
@radektomasek
Posted
@ryan17stehle Hi Ryan,
thank you very much. It's very beneficial you pointed that in my direction, and I will dig into this more.
I still experiment with everything to find the most balanced approach (As an experienced dev, I have been comfortable with CSS and some of the best practices, but not with Tailwind ones).
If you look into my newer submission, I took this approach even further and utilized CSS variables.
The reason why I considered as a promising approach is that I could abstract some of the common, repeating elements (h1, p, etc.) into the wrapped units—and then add a few extra classes with clearly defined tailwind utilities.
In my case, I like that approach because, as a frontend dev, I can see a lot of benefits of this approach, too (e.g. some automated tooling could pick up class names more quickly).
But I appreciate your feedback and will dig into this more to see what improvements I can make.
Radek