Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Last active December 27, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanbrujo/7337273 to your computer and use it in GitHub Desktop.
Save juanbrujo/7337273 to your computer and use it in GitHub Desktop.
LESS basic loop
selector:nth-child(4) {
property: 4px;
}
selector:nth-child(3) {
property: 3px;
}
selector:nth-child(2) {
property: 2px;
}
selector:nth-child(1) {
property: 1px;
}
.loop(@index) when (@index > 0){
selector:nth-child(@{index}) {
property: @index * 1px;
}
.loop(@index - 1);
}
.loop(0){}
.loop(3); // loop 3 times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment