0

Reading some articles about string interpolation in LESS I've tried the following, which didn't work for me:

.wk (@property, @data) {
                 @property: @data;
    ~"-webkit-@{property}": @data;
}

If i try to compile this, using Crunch, I get an error:

Unrecognized Input

Is there another way to escape this or get this compiled?

Andre Silva
  • 4,782
  • 9
  • 52
  • 65
bquarta
  • 559
  • 6
  • 19

1 Answers1

2

Unfortunately less doesn't support property name interpolation, but this answer has a great hack for doing it anyway. But it results in a bunch of dummy, useless rules. So you end up with something like this:

#usage {
  _: 0 ; -webkit-border-radius: 3px;
  _: 0 ; -moz-border-radius: 3px;
  _: 0 ; border-radius: 3px;
}
Community
  • 1
  • 1
dezman
  • 18,087
  • 10
  • 53
  • 91