3 ms·
What if component A and component B need that button? You will comp-a,comp-b{.button{}}? Will you save in comp-a-and-comp-b.scss? What if you need in comp-c and
by ttty 12y ago
What if component A and component B need that button? You will comp-a,comp-b{.button{}}? Will you save in comp-a-and-comp-b.scss? What if you need in comp-c and comp-d? As you can see your button is not tight to that comp.
I prefer to have a button class, for example in react that when instanced renders all the time the same. It boundles it's css within, just like this lib.
- nawitus 12y agoYou could use the namespace feature of Less for that: http://lesscss.org/features/#features-overview-feature-namespaces-and-accessors http://lesscss.org/features/#features-overview-feature-names... I haven't personally used it, though. Another solution would be have a "button.less" like this: comp-a, comp-b, comp-c { .button { } }
- talmand 12y agoThere's nothing stopping you from doing any of that with CSS today, especially if you use SASS or LESS.
- Offler 12y agoSASS and LESS are CSS DSLs, you are doing limited programming with CSS, at that stage you may as well do programming in a Turing complete language like JS and reduce the number of tools in your tool chain.