DEV Community

Discussion on: 6 reasons to use Tailwind over traditional CSS

Collapse
 
lil5 profile image
Lucian I. Last

It should be known that Tailwind is not going to be DRY when used in an environment where you'll be copy and pasting HTML

I disagree, if you learn a bit of postcss ‘@apply’, you can create your own btn css classes then build from there. That’s one of the beauties of tailwind as soon as there is duplication you can extract and extend

tailwindcss.com/docs/utility-first...

Collapse
 
charliejoel profile image
Charlie Joel

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! :)

Collapse
 
lil5 profile image
Lucian I. Last

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 ;-)