lessphp icon indicating copy to clipboard operation
lessphp copied to clipboard

recursive mixin not working in nested rule

Open sebenik opened this issue 5 years ago • 0 comments

Input:

.nested-class(4);

.nested-class(@n, @i: 1) when (@i =< @n) {
  .class {
    .nested-class(@n, (@i + 1));
    width: (@i * 100% / @n);
  }
}

Expected output:

.class {
  width: 25%;
}
.class .class {
  width: 50%;
}
.class .class .class {
  width: 75%;
}
.class .class .class .class {
  width: 100%;
}

Wrong output of lessphp:

.class {
  width: 16.666666666667%;
}
.class .class {
  width: 33.333333333333%;
}

sebenik avatar Jan 16 '19 13:01 sebenik