I stumbled over the same question and I've found a solution.
First make sure you upgrade to LESS 1.6 at least.
You can use npm
for that case.
Now you can use the following mixin:
.if (@condition, @property, @value) when (@condition = true){
@{property}: @value;
}
Since LESS 1.6 you are able to pass PropertyNames to Mixins as well. So for example you could just use:
.myHeadline {
.if(@include-lineHeight, line-height, '35px');
}
If @include-lineheight resolves to true LESS will print the line-height: 35px
and it will skip the mixin if @include-lineheight is not true.