Mixins with LESS are really simple:
.some-rules() {
/* some rules */
}
.some-class {
.some-rules;
}
However, suppose I've got a ruleset within a media query, like:
@media (min-width: 800px) {
.my_ruleset {
/* more rules */
}
}
How can I include such a ruleset as a mixin?
My motivation here is that I am using Bootstrap. I am trying to avoid semantically polluting my markup with its selectors, and would rather incorporate its rulesets as mixins. That's simple enough given the first example above, but I'm not sure how to incorporate the @media selectors.
EDIT
Specifically, here is a summary of the code I am trying to use as a mixin:
.container {
.container-fixed();
}
// ...
@media (min-width: @screen-sm) {
.container {
max-width: @container-sm;
}
// ...
}
@media (min-width: @screen-md) {
.container {
max-width: @container-md;
}
// ...
}
@media (min-width: @screen-lg-min) {
.container {
max-width: @container-lg;
}
// ...
}