3 ms·
> especially when there are hundreds of primary buttons throughout the app, each with a slight variation. If you're repeating monstrous groups of styles like t
by pcthrowaway 3y ago
> especially when there are hundreds of primary buttons throughout the app, each with a slight variation.
If you're repeating monstrous groups of styles like the one in the blog post, but with a slight variation for each, then you're tremendously far out in the weeds and almost definitely shouldn't be using tailwind
Tailwind really only works for a component-based framework (like React, Svelte, Solid, etc.), where you define a component representing a button, and give it props to map to the 'minor variation' you want.
That way if you need to support e.g. a new device class, you just add the relevant class names there and don't have to revisit your entire codebase.
This isn't apparent at all when inspecting the source of a site using tailwind, because as far as the rendered markup is concerned, these are getting repeated (and the verbosity of the output is absolutely a fair criticism)
But if you're writing it, and organizing your components in a sensible way, then the problem you mention doesn't exist.