Skip to content

Instantly share code, notes, and snippets.

@cloudhead
Created February 28, 2012 16:51
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudhead/1933613 to your computer and use it in GitHub Desktop.
Save cloudhead/1933613 to your computer and use it in GitHub Desktop.

Variadic argument support in LESS 1.3.0

.mixin (...) {        // matches 0-N arguments
.mixin () {           // matches exactly 0 arguments
.mixin (@a: 1) {      // matches 0-1 arguments
.mixin (@a: 1, ...) { // matches 0-N arguments
.mixin (@a, ...) {    // matches 1-N arguments

Furthermore:

.mixin (@a, @rest...) {
   // @rest is bound to arguments after @a
   // @arguments is bound to all arguments
}
@petrbrzek
Copy link

Markdotto: You can do this.

.lol(@arg...){
  background: ~`"@{arg}".replace("]","").replace("[","")`;
}
.lol(hi,lol,rofl);

result: background: hi, lol, rofl;

@himynameisdave
Copy link

Very useful reference, even from 2014.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment