Skip to content

Instantly share code, notes, and snippets.

@aebsr
Created November 22, 2013 16:35
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 aebsr/7602833 to your computer and use it in GitHub Desktop.
Save aebsr/7602833 to your computer and use it in GitHub Desktop.
replace list nums
// 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