Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use Map inside each #3366

Closed
omidgfx opened this issue Feb 12, 2019 · 2 comments
Closed

Can't use Map inside each #3366

omidgfx opened this issue Feb 12, 2019 · 2 comments

Comments

@omidgfx
Copy link

omidgfx commented Feb 12, 2019

let's say I have this less:

@threshold:{
  a:50;
  b:200;
};

@themes:{
  a:red;
  b:blue;
};

.mymixin(@name,@color,@thrshld){
  //do-something
}

each(@themes,{
  .mymixin(@key,@value,@threshold[@key]);
});

This code gives following error:

RuntimeError: error evaluating function each: variable @key not found...

I'm using v3.9.0

How can I use Maps in each function?

@dmgawel
Copy link

dmgawel commented Feb 16, 2019

You can achieve that using $@ (Variable properties):

each(@themes,{
  .mymixin(@key,@value,@threshold[$@key]);
});

See: #3362 and docs issue: less/less-docs#500

@seven-phases-max
Copy link
Member

Closing as not an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@dmgawel @omidgfx @seven-phases-max and others