I've got following LESS variables:
@dashboard-height: 90.5%;
@dashlet-header-height: 35px;
@dashboard-margin: 0px;
@dashlet-border: 1px;
and I want to calculate following classes:
.generate-dashlet-classes(6);
.generate-dashlet-classes(@n, @i: 1) when (@i =< @n) {
&.dashlet-@{i} .dashlet-content {
height: round((calc(@dashboard-height - (@i * (@dashlet-header-height + @dashboard-margin + @dashlet-border)))) / @i, 6);
}
.generate-dashlet-classes-times(@i);
.generate-dashlet-classes(@n, (@i + 1));
}
.generate-dashlet-classes-times(@i, @times:1) when (@times < @i) {
&.dashlet-@{times}-x-@{i} .dashlet-content {
@dashletContainerHeight: (@dashlet-header-height + @dashboard-margin + @dashlet-border);
height: round(((calc(@dashboard-height - (@i * @dashletContainerHeight))) / @i * @times) + (@dashletContainerHeight * (@times - 1)), 6);
}
.generate-dashlet-classes-times(@i, (@times + 1));
}
Now the compiler throws following error:
>> SyntaxError: Operation on an invalid type in app/styles/less/main.less on line 338, column 5:
>> 337
>> 338 .generate-dashlet-classes(6);
>> 339 .generate-dashlet-classes(@n, @i: 1) when (@i =< @n) {
There would be no error if @dashboard-height would have a px value and no calc() would be used. But when mixing percentages and px values, we have to use calc(), don't we?