Recursive Mixins broken
Hey,
thank you for maintaining lesserphp :-)
However, there seems to be a regression: Recursive mixins are now broken.
An example that works in the original leafo/lessphp, but is broken in this repository:
div {
.loop-grid-columns(4, class, width);
}
@grid-columns: 12;
.loop-grid-columns(@index, @class, @type) when (@index >= 0) {
.calc-grid-column(@index, @class, @type);
// next iteration
.loop-grid-columns((@index - 1), @class, @type);
}
.calc-grid-column(@index, @class, @type) when (@type = width) and (@index > 0) {
.col-@{class}-@{index} {
width: percentage((@index / @grid-columns));
}
}
expected outcome (see it at less2css.org):
div .col-class-4 {
width: 33.33333333%;
}
div .col-class-3 {
width: 25%;
}
div .col-class-2 {
width: 16.66666667%;
}
div .col-class-1 {
width: 8.33333333%;
}
However the repo MarcusSchwarz/lesserphp gives me the error .calc-grid-column is undefined: failed at .calc-grid-column(@index, @class, @type); in mixins.less at line 9
git bisect says the behavior was broken in 62dd2c7e7da2d8a1a598840890fd41dcca70877a
Probably because of the removal of returning the default parameter in get() method.
Hi @micgro42 could you check out https://github.com/MarcusSchwarz/lesserphp/tree/0.5.3 and test if your project works as expected with that branch? I've shamelessly stolen your example and built a test upon it which works, but breaks other things introduced in the pr @splitbrain mentioned.
I'm unsure what the status is here. @micgro42 will probably not be able to verify if the original problem has been fixed because we changed the sources to work around the broken feature in the meantime. But since the test case works, I would assume the fix works as intended.
However, @MarcusSchwarz you mention that your fix breaks other stuff. Is there anything we can help with here?