scss-library/components/00_Tools/_elementAmount.styl

12 lines
315 B
Stylus

RV-Utils__ElementAmount(amount, callback)
if amount == 1
&:only-child
callback(i, amount)
else
*:first-child:nth-last-child({i}),
*:first-child:nth-last-child({i})~*
callback(i, up-to)
RV-Utils__ElementAmount--range(from=1, to=20, callback)
for i in (from..to)
RV-Utils__ElementAmount(i, callback)