Jeffpowrs
Jeffpowrs

Reputation: 4540

Using Less mixin variable as a property value

I'm looking to supply a property name through a Less Mixin. I'm some what new to preprocessors and have been jumping between Less and Sass on various projects. What I'm trying to do is something like this:

  .prefix-prop(@prop; @value) {
    -moz-@{prop}: @value;
    -ms-@{prop}: @value;
    -webkit-@{prop}: @value;
    @{prop}: @value;
  }

I see collections of mixins that will have a mixin for every css property. Why have that if you can just use one function for all of that? That leads me to believe that this cannot be done. Though I cannot seem to find a definitive answer. Thanks in advance!

Upvotes: 2

Views: 1236

Answers (1)

BenM
BenM

Reputation: 53198

The feature is being added (according to the LESS devs), but still hasn't shipped. I'd recommend following the commits on GitHub.

Interesting reading in this issue > https://github.com/less/less.js/issues/36

Upvotes: 2

Related Questions