Created
November 22, 2013 16:35
-
-
Save aebsr/7602833 to your computer and use it in GitHub Desktop.
replace list nums
This file contains hidden or 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
// The Mixin | |
.replace-nums (@index) when (@index > 0) { | |
&:nth-child(@{index}):before { | |
content: '@{index}' | |
} | |
.replace-nums(@index - 1); | |
} | |
.replace-nums (@index, @content) when (@index > 0) { | |
&:nth-child(@{index}):before { | |
content: '@{index}@{content}' | |
} | |
.replace-nums(@index - 1, @content); | |
} | |
// Usage | |
ol li { | |
.replace-nums(5); | |
li { | |
.replace-nums(5, ')'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment