Uncompiling Mixins in LESS
The class we use as a mixin will also be included in the compilation output.
There are, however, situations when we want to create some piece of code as a blank for use in other places in the code, and at the same time this piece itself will not be used.
To prevent a mixin from being compiled, you need to put parentheses after its name, like this:
.mix() {
width: 100px;
height: 100px;
}
Tell me what the result of compiling the following code will be:
.mix() {
color: white;
background: black;
}
p {
.mix;
width: 300px;
}
Tell me what the result of compiling the following code will be:
.mix1() {
color: white;
background: black;
}
.mix2() {
width: 300px;
height: 300px;
}
p {
.mix1;
.mix2;
}
Create a mixin .tnr
, which will specify a font of the Times New Roman
family.
Create a mixin .df
that will set the display
property to flex
.
Create a mixin .bold
that will set the font-weight
property to bold
.
Create a mixin .nowrap
that will set the property white-space
to nowrap
.