Re:Tailwindo: Convert Your Bootstrap CSS to Tailwind CSS
by pcr910303 on Tuesday June 15, 2021 @01:11PM
(#27518367)
> it's an optimized way to do inline styles for component based architectures, because it turns out inline-styles are actually a pretty good way to style re-usable components
Yeah, I also understand Tailwind as inline-styles without it's problems:
* it provides less choices (instead of 256*3 colors you have limited choices)
* classes are (a lot) faster than inline styles in most browsers
* has access to features that inline styles can't (e.g. media queries)
In the more traditional method, you would style a <button> element in a CSS file and never think about it again, while it inevitably becomes part of the CSS nest. If you wanted to use tailwind for a normal non-component based site you'd have to individually style every single button again and again, as there's no cascading and no globally applied styles. I wouldn't use tailwind in that cirucmstance.
But because it's more likely you're using vue/react and your buttons are actually defined as a <Button> component that you re-use, you can write the styles directly on the component where it's used, co-locating the code and making maintenance a bit easier in the process.