D
D
Damir Sayahov2016-09-13 10:15:18
Less
Damir Sayahov, 2016-09-13 10:15:18

How to use variable as class name in LESS mixin?

Caution, terrible wrong syntax.
How can you write such a mixin?

.social(@social, @color){
  .color_[email protected]social{
    color: @color;
  }
}

What would with such a call
.social('facebook', '#ff0000');
.social('vkontakte', '#00ff00');

was this the result?
.color_facebook{
  color: #ff0000;
}
.color_vkontakte{
  color: #00ff00;
}

I understand that LESS is not ok right now, but please don't suggest anything else. We need to resolve this issue on LESS.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Flan, 2016-09-22
@damir_sayahov

So?

.social(@social, @color){
  [email protected]{social} {
    color: @color;
  }
}

.social(facebook, #ff0000);
.social(vkontakte, #00ff00);

preview

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question