4 ms·
LESS uses ".class" extendig dor mixins. It's totally wrong, you don't need to extend a class, 'cause you can assign multiple classnames to a DOM node. The only
by lvivski 14y ago
LESS uses ".class" extendig dor mixins. It's totally wrong, you don't need to extend a class, 'cause you can assign multiple classnames to a DOM node. The only thing you need to extend is a set of declarations (properties), so you create a new declaration which contains all declarations you need, so that you can reuse them.
- nilliams 14y agoBelieve SASS can do what you're describing with @extend and %silent directive: http://codepen.io/bpainter/pen/FxHEm http://codepen.io/bpainter/pen/FxHEm (Example courtesy of this East Wing podcast episode on SASS: http://theeastwing.net/episodes/26-bermon http://theeastwing.net/episodes/26-bermon).
- lvivski 14y agoBOSS uses different approach. If you want to have declarations of "button" in "button-primary" you can just write <button class="button button-primary"> But is you want to reuse some fancy image-border "button" and "input", so they may have nothing in common, except that image-border. You can create a mixin with desired declarations for all browser, and then use it in your code as simple as "fancy-image-border: url('image.png')". And all rulesets, that have this "fancy-image-border" will then get a list of declarations in place of this mixin. So you see, the syntax is pretty simple and matches CSS-syntax. You don't need @extends or smth else, you just have to know the name of mixin declaration.
- criswell 14y agoYou can also just do button[class^=button] and use class names like "button-primary". It would be less repetitive code in the output CSS and less in the HTML. I'm so glad attribute selectors are actually OK to use now.