1

I have variable and need to construct mixin with its value:

$param = 'color';

{$param}() {
  color: green;
}

.foo {
  color: red;
}

It's renders as

color() {
  color: #008000;
}
.foo {
  color: #f00;
}

But I need

.foo {
  color: #008000;
}

Maybe, I don't know, how to do it right.
How can I get it?

Ser-Gen
  • 85
  • 5

1 Answers1

2

I have got answer from maintainer of Stylus:

You can do this with define bif and anonymous functions:

$param = 'color'

define($param, @() {
  color green
})

.foo
  color red
Ser-Gen
  • 85
  • 5