I have a mixin in Less to set the text-transform
-property:
.text-transform(@type: none) {
& when (upper = @type) {
@type: uppercase;
color: red;
}
text-transform: @type;
}
Which works fine for calls like:
.text-transform(none);
.text-transform(uppercase);
Now I want to shorten the syntax and allow:
.text-transform(upper);
.text-transform(lower);
I tried to update the variable inside the mixin, like:
@type: uppercase;
@type: "uppercase";
But it won't change and the resulting rule is:
text-transform: uppper;
I also tried @type: "@{type}case";
, which resulted in an endless recursion.
The branch is executed, however. The test to change the color to red passed successfully.
How ca I update the variable?