4 ms·
>If tomorrow I want to change the color of all the buttons in my app I need to go to each HTML and update them. If you find yourself repeating a certain combin
by savanaly 2y ago
>If tomorrow I want to change the color of all the buttons in my app I need to go to each HTML and update them.
If you find yourself repeating a certain combination of classnames over and over, you should refactor to make that a variable and use it in all the places where the repetition is. You might ask how is this different from CSS if these variables containing inline css are just classnames under another name? I would respond that they are basically the same thing, but Tailwind excels in the case where you need a style "just for this one spot" because you don't have to create a classname and edit two different files (html and css) to achieve the effect.
- pphysch 2y ago> Tailwind excels in the case where you need a style "just for this one spot" because you don't have to create a classname and edit two different files (html and css) to achieve the effect. Inline style attributes and <style> blocks already solve this... I suspect most of the mania around CSS frameworks is that people don't grok that you don't HAVE to put everything in one big external .css file -- there is a spectrum of ways to declare CSS and with modern browser dev tools it becomes easy to understand where each rule is coming from.
- steveklabnik 2y ago> Inline style attributes and <style> blocks already solve this... Sure. The point of tailwind is to make this nicer, not to fully replace it. I find the naming scheme and helpers they provide to make writing CSS a lot easier. Mind you, I would never claim to be a CSS expert in the first place. But Tailwind isn't trying to be something different, it's trying to make something easier and better. I like vim too. I feel like there's a vague similarity here.
- threatofrain 2y agoI would argue that Tailwind's job is to basically fully replace everything if done idealistically. You want the ability to focus on a single component without thinking that there's CSS somewhere else.
- steveklabnik 2y agoI do agree that it's best practice to always use only the tailwind classes, I guess what I mean is, it's not like it makes it impossible to use just CSS. It is, in my mind, a nicer way to write CSS, that brings some of its own advantages, but it's not like, fancy magic. It is CSS, fundamentally, not something else.