LESS mixins can be extended into sort of functions in which they accept parameters more than once, it is being called Parametric Mixins. Through these parameters you are able to customize the mixin output in according to what you passed through the parameters.
.border(@border-width; @border-style; @border-color) {
border: @border-width @border-style @border-color;
}
The above code snippet shows our previous .border mixin has now turned into a Parametric Mixin with three parameters. Now, we are able to customize the border property values, namely the border-width, style, and color, for instance:
.header {
.border(2px; dotted; red);
}
Output
.header {
border: 2px dotted #ff0000;
}
0 Comment(s)