Created
July 6, 2012 14:04
-
-
Save simonsmith/3060329 to your computer and use it in GitHub Desktop.
Nested loops in LESS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.outer(@outer) when (@outer > 0) { | |
(~".outer@{outer}") { | |
color: red; | |
.inner(@inner) when (@inner > 0) { | |
font-size: @inner; | |
.inner(@inner - 1); | |
} | |
.inner(0) {} | |
.inner(@outer); | |
} | |
.outer(@outer - 1); | |
} | |
.outer(0) {} | |
// Gives you | |
.outer3 { | |
color: red; | |
font-size: 3; | |
font-size: 2; | |
font-size: 1; | |
} | |
.outer2 { | |
color: red; | |
font-size: 2; | |
font-size: 1; | |
} | |
.outer1 { | |
color: red; | |
font-size: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment