I have a scenario where if a custom variable is passed in via webpack I'd like to override a bunch of default variable values.

I was hoping to write a mixin to simplify things where if a custom variable value is passed in then using a parameter for that mixin refer to a variable name like so:

.setGuardedOption (@variableName, @proposedValue:none) when (iscolor(@proposedValue)) {
    @variableName: @proposedValue;

.setGuardedOption(~"themeColor", @customThemeColor);
.setGuardedOption(~"dude", #ff0000);

.test1 {
    background-color: @dude;

.test2 {
    color: @customThemeColor;

Here I'm seeing @dude is not defined

What I'm hoping to achieve is have both the variables @themeColor: set to the value of @customThemeColor

and @dude: #ff0000;

0 Answers