lesserphp icon indicating copy to clipboard operation
lesserphp copied to clipboard

Recursive Mixins broken

Open micgro42 opened this issue 6 years ago • 3 comments

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

micgro42 avatar Oct 11 '17 17:10 micgro42