I totally agree with you there - there's definitely more than one way to skin a cat with Tailwind. Using the @apply directive you can build a stylesheet the same way you might with SCSS.
My only issue with this method, though, is that it doesn't fully embrace the benefits of Tailwind: If you're going to write custom classes, why not just use custom CSS like BEM? You still need to write the styles in a different file and wait for it to compile, and if you create custom classes for everything you might end up with a larger bundle size.
I can see the benefit of using a hybrid of BEM and Tailwind for sure though, as you can use Tailwind's margins and spacing classes alongside regular BEM classes for more flexibility.
The difference is the outlook, it is not an all or nothing, one can choose to make classes for the locations where the majority is a duplicated, keeping things DRY without the need to name classes which will be used once.
But thatβs my 4cents, thanks for the read ;-)
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 totally agree with you there - there's definitely more than one way to skin a cat with Tailwind. Using the @apply directive you can build a stylesheet the same way you might with SCSS.
My only issue with this method, though, is that it doesn't fully embrace the benefits of Tailwind: If you're going to write custom classes, why not just use custom CSS like BEM? You still need to write the styles in a different file and wait for it to compile, and if you create custom classes for everything you might end up with a larger bundle size.
I can see the benefit of using a hybrid of BEM and Tailwind for sure though, as you can use Tailwind's margins and spacing classes alongside regular BEM classes for more flexibility.
Thanks for your comment! :)
The difference is the outlook, it is not an all or nothing, one can choose to make classes for the locations where the majority is a duplicated, keeping things DRY without the need to name classes which will be used once.
But thatβs my 4cents, thanks for the read ;-)