Last active
December 21, 2015 03:48
-
-
Save calvinjuarez/6244586 to your computer and use it in GitHub Desktop.
Basic LESS loop to generate as many numbered classes as necessary, extended to keep the CSS DRYer.
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
.example-1, | |
.example-2, | |
.example-3, | |
.example-4, | |
.example-5 { | |
/* stuff */ | |
} |
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
.example-1 { | |
/* stuff */ | |
} | |
.example { | |
// Loop | |
.loop(@index) when (@index > 1) { | |
.loop((@index - 1)); | |
&-@{index} { | |
&:extend(.example-1); | |
} | |
} | |
.loop(@index) when (@index =< 1) {} | |
// Generate | |
.loop(5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment