DEV Community

Discussion on: TailwindCSS: Adds complexity, does nothing.

Collapse
 
rubinelezi profile image
Rubin Elezi

Search and replace does not work all the time, as sometime you have to apply logic to it. Maybe you want to update only 763 elements.

Collapse
 
rsa profile image
Ranieri Althoff

In that case, you will still need to go one by one changing the class if you just put "button" in all of them.

Thread Thread
 
kerryboyko profile image
Kerry Boyko

You shouldn't. If the class is .button, and the .button class is only defined once, then one change to the .button class definition in your css should apply to all items that have the .button class.

I should have been clearer in my example by using something like ".branded-button" but you do see how you don't have to go in one by one, right? Because you're not changing what the class is named, only what the class does.

Thread Thread
 
milan090 profile image
Milan

You often create a component for these scenarios, making different button components and reusing them. This pattern follows DRY too and also gives you the tooling and productivity of tailwind.