iLevi
iLevi

Reputation: 936

Pass arguments to mixin from single variable array

I have the next mixin:

@mixin mymixin($arguments...){...}

commonly we can call the mixin in this way:

@include mymixin(arg1, arg2, arg3);

but in this case i have the next variable

$arguments: (arg1, arg2, arg3)

I want call the mixin and pass $arguments variable... is there a way to do this? is like javascript apply()

Note that $arguments is dinamic size, and mixin takes all arguments and parse each one. Regards.

Upvotes: 1

Views: 295

Answers (1)

Zach Esposito
Zach Esposito

Reputation: 727

Yes you can pass a list to a mixin that takes an arglist by adding ellipsis when calling the mixin:

@include mymixin($arguments...);

Source: https://github.com/sass/sass/issues/1849

Upvotes: 1

Related Questions