6

This might be a quick and easy question, but I was still unable to find the answer.

In less, is there any way of using a mixin (say .mixin(@a: 2, @b: 3) { /* css here */ }) and only supplying values for given parameters? I know I can use this as .mixin(5) which would be the same as .mixin(5, 3), but can I do something like .mixin(@b: 5)? Meaning the same as .mixin(2, 5) (however I wouldn't have to know the value of a to use the default).

1 Answer 1

13

In less using the dotless compiler you can do

.mixin(@b:3);

This will be in the original less.js in 1.3.1 (the next release)- see https://github.com/cloudhead/less.js/pull/268

2
  • in where? if its in less.js, then 1.3.1 hasn't yet been released - are you using the latest from the repository?
    – Luke Page
    Commented Aug 15, 2012 at 10:14
  • Ah, I miss read that part about it not being released yet. I'm using the LESS.app to compile. Looking at the Version History it's not been updated yet. incident57.com/less/versionHistory.html Digging around the app now to try and update it myself.
    – Foxinni
    Commented Aug 15, 2012 at 10:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.