Below are the LESS variables that I am working with:
@dashboard-height: 90.5%;
@dashlet-header-height: 35px;
@dashboard-margin: 0px;
@dashlet-border: 1px;
I am trying to generate the 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));
}
An error is now being thrown by the compiler:
>> 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) {
If @dashboard-height had a px value and calc() was not used, there would be no error. However, when mixing percentages and px values, we must use calc(), correct?