I have following less:
@threshold:{
a:50;
b:200;
};
@themes:{
a:red;
b:blue;
};
.mymixin(@name,@color,@thrshld){
//do-something
}
each(@themes,{
.mymixin(@key,@value,@threshold[@key]);
});
By running the code, following error occurs:
RuntimeError: error evaluating function
each: variable @key not found...
I'm using v3.9.0
How can I use Maps in each function?
You need to use the @map[$@property] syntax to evaluate the value of @map[@property]
.mymixin(@name, @color, @thrshld) {
.theme-@{name} {
color: @color;
width: @thrshld;
}
}
@threshold: {
a: 50;
b: 200;
};
@themes: {
a: red;
b: blue;
};
each(@themes, {
.mymixin(@key, @value, @threshold[$@key])
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With