I cannot figure out how to create a self-selector. My best guess would be:
.mixin(@var) {
&(~':nth-of-type(@{var}n)') {
// do stuff
}
}
But when used as
.el { .mixin(3); }
Produces
.el :nth-of-type(3n) { //do stuff }
And fails to produce the desired result.
Any help on this front is appreciated. Thanks.
It depends on which version of LESS you're using, but with 1.3.3, this should work
.mixin(@var) {
@nthItem: ~":nth-of-type(@{var}n)";
&@{nthItem} {
// do stuff
}
}