bquarta
bquarta

Reputation: 569

LESS string interpolation with Crunch?

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?

Upvotes: 0

Views: 140

Answers (1)

dezman
dezman

Reputation: 19368

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;
}

Upvotes: 2

Related Questions