2

I have a variable:

@test: this_is_var;

And I have class

.my-@{test}-class{}

How to print this class in another class?

This code is wrong:

.test-class{
    .my-@{test}-class();
}

But this code is work fine

.test-class{
    .my-this_is_var-class();
}

Why? And how to print this class: .my-@{test}-class()?

Turnip
  • 35,836
  • 15
  • 89
  • 111
mixalbl4
  • 3,507
  • 1
  • 30
  • 44
  • 4
    There's no way (you can't invoke a mixin by a "dynamic name", though eventually this is planned to be supported indirectly via mixin references). See disscussion at [#1399](https://github.com/less/less.js/issues/1399#issuecomment-33021350) for why direct "variable interpolation in mixin call" feature would be a bad practice. If you provide your use-case I'm pretty sure we could recommend a better solution. – seven-phases-max Jul 22 '15 at 16:12
  • Up for a use-case reference! – Jeremy Zahner Jul 28 '15 at 23:08
  • possible duplicate of [Is it possible to reference a variable with an interpolated string?](http://stackoverflow.com/questions/6010013/is-it-possible-to-reference-a-variable-with-an-interpolated-string) – Paul Sweatte Jul 30 '15 at 18:34

1 Answers1

0

Your wrong variant works nice in codepen. Maybe you must write ~{} in your variable. Here is an example.

ostinred
  • 116
  • 7