leafo / lessphp

LESS compiler written in PHP
http://leafo.net/lessphp
Other
2.2k stars 527 forks source link

recursive mixin not working in nested rule #644

Open sebenik opened 5 years ago

sebenik commented 5 years ago

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%;
}