user2882335 user2882335 - 27 days ago 15
Sass (Sass) Question

Pass a mixin a list and a variable

Is it possible to pass a list of parameters as well as another separate parameter.

Something like

@mixin cols($width...,$gutter) {
....
}


@include cols((4,4,4),2%);

Answer

I think yes we can do that.non list parameters should be before list/array parameters

check this snippet

@mixin box-shadow($color,$shadows...) {
  -moz-box-shadow: $shadows;
  -webkit-box-shadow: $shadows;
  box-shadow: $shadows;
  background:$color;
}

.shadows {
  @include box-shadow('red',0px 4px 5px #666, 2px 6px 10px #999);
}

http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#variable_arguments

Hope this helps