LESS Advanced Arguments and @rest Variable


Advertisements

Description

Mixin takes variable number of arguments by using .... You can assign arguments to the variable by placing ... after the variable name.

The following program shows simple formats of using arguments −

.mixin(...) {        // it matches arguments from 0-n
.mixin() {           // it matches exactly 0 arguments
.mixin(@x: 1) {      // it matches arguments from 0-1
.mixin(@x: 1; ...) { // it matches arguments from 0-n
.mixin(@x; ...) {

You can use the @rest variable in the code as −

.mixin(@x; @rest...) {
   // after the variable @a, the @rest is bound to arguments
   // @arguments is bound to all arguments
}
less_parametric_mixins.htm
Advertisements