4 ms·
_variables.sass works if you're using BEM. But now you have two component-like things: BEM classes, and the components themselves. BEM solves the issues inheren
by jasim 8y ago
_variables.sass works if you're using BEM. But now you have two component-like things: BEM classes, and the components themselves. BEM solves the issues inherent in nested CSS (cascade, inheritance, multiple selectors, specificity) by forcing us to never nest them, and instead having to name every single element in HTML. Though they look semantic, they are not truly reusable since they are coupled deeply with the markup. But with Tailwind, your component is your unit of abstraction and you don't have to name everything just for the sake of hooking up the HTML with CSS.
But you can even do BEM with Tailwind if you really want to with @apply.
> Why would you change a padding in multiple files when you can set `$base_padding: 10px`?
Neatly written CSS that uses variables for design scales are a good thing to have, but without any kind of tooling help, it is really difficult to keep it consistent. Tailwind on the other hand gives you the affordance for that - a "pit of success" because you never have to define magic values and instead use pre-defined functional CSS classes.
Regarding colors - you can use "text-quiet" or "text-title" etc. - the names are fully in your control and can be set in the configuration JSON file.
- e12e 8y agoBEM?
- Raphmedia 8y agoBEM — Block Element Modifier is a methodology that helps you to create reusable components and code sharing in front-end development http://getbem.com/introduction/ http://getbem.com/introduction/ In short, you do things like this: .form { } .form--theme-xmas { } .form--simple { } .form__input { } .form__submit { } .form__submit--disabled { } Where the prefix __ is an Element and -- is a Modifier. So, in that example you have the form, the form with Christmas modifier and also a form button that is expected to only happen under forms.