2

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!

2
  • It's worth noting that blindly adding prefixes to every single property that may need prefixes is a good way to add unnecessary bloat. Note that the Compass library for Sass only adds prefixes as necessary for the property in question. Commented Jul 29, 2013 at 16:04
  • Agreed, I'm just using that as an example. I've heard very good things compass but haven't used it. I've also used prefixr sublime text package which does a similar thing in terms of prefixing properties. I may just rely on that until less implements the update. Good call on pointing that out! Commented Jul 29, 2013 at 16:40

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.