Concatenation by space in LESS
There are properties whose values need to be combined not with a comma, but with a space. For such combinations, there is a special operator +_
.
Let's look at how it works using the transform
property as an example. Let's create functions .rotate
and .skew
that define the corresponding transformations:
.rotate(@r) {
transform+_: rotate(@r);
}
.skew(@s) {
transform+_: skew(@s);
}
Let's use our functions:
div {
.rotate(10deg);
.skew(10deg);
}
As a result of compilation, our transformations will be combined into one property transform
:
p {
transform: rotate(10deg) skew(10deg);
}
Implement a similar function scale
that specifies the corresponding transformation.
Implement a similar function translate
that specifies the corresponding transformation.