2 ms·
It sounds like you are wanting to use some classes (like btn-group) as mixins, when this would not be a good practice, even if it worked the way you are attempt
by jcomis 14y ago
It sounds like you are wanting to use some classes (like btn-group) as mixins, when this would not be a good practice, even if it worked the way you are attempting. You don't want to compile the btn-group less to css in every instance of it's usage, it would be repetitive. That's why it's a class rather than a mixin. I see mixins mainly as timesavers to simplify stuff which requires browser prefixes or can be reused through variables. So I wouldn't want to drop .btn-group into a customized class I'm writing, I'd just include it in <ul class="btn-group custom-class">.
I might be misunderstanding you, and I might just be wrong (I am not a less expert).
- jewbacca 14y agoMakes sense from a practical standpoint, but I think what I'm looking for is something that, while widely advocated[0], either: -Doesn't seem to be common practice -I'm misunderstanding -Bootstrap's LESS just doesn't support, or at least leaves totally undocumented Doing stuff like this seems to be one of the major motivations behind LESS/SASS in the first place [1][2]. Basically what I want to say is that <ul> (probably a particular subset of <ul>s, specified by selector combinators) should be styled like a .btn-group. That is the behaviour I'd naively expect, and is certainly the behaviour I want. However it can be done [3]. Also, in SASS, you would use selector inheritance -- `ul {@extend .btn-group}` -- which would compile to `ul, .btn-group {...}` and not bloat the output CSS... if it worked at all. But something either in the design of Bootstrap's LESS (and carried over into the bootstrap-sass port), or in some inherent limitations of LESS/SASS, prevents this. The only way it seems to work is directly applying the presentational class in your HTML, as you've suggested. So what I'm trying to figure out is whether my expectations are faulty, or some stage of the design is faulty. It's possible, and even advocated (though by 3rd-parties), to do what I'd like to do with some components of Bootstrap, but not with others. If there is any way at all to be able to not specify <class="btn-group"> in the HTML, and have a preprocessor fully apply the styles, even if it turns out to be a bad idea, I'd love to know it if only for the purposes of learning these frameworks, and better understanding their design. ---- [0]https://www.google.ca/search?q=semantic+classes+html https://www.google.ca/search?q=semantic+classes+html [1] http://lesscss.org/ http://lesscss.org/ [2] http://ruby.bvision.com/blog/please-stop-embedding-bootstrap-classes-in-your-html http://ruby.bvision.com/blog/please-stop-embedding-bootstrap... [3] But I'll fight ravenously against anything less than clean and terse (which is admittedly a weakness of mine, and one that's stunted my programming growth severely)