Skip to content

Instantly share code, notes, and snippets.

@cwparsons
Last active August 29, 2015 14:02
Show Gist options
  • Save cwparsons/04c4eb7b112d56f21a08 to your computer and use it in GitHub Desktop.
Save cwparsons/04c4eb7b112d56f21a08 to your computer and use it in GitHub Desktop.
List various properties with corresponding variables
// Mixin
.list-properties(@property, @list, @index: length(@list)) when (@index > 0) {
.list-properties(@property, @list, (@index - 1));
@value: extract(@list, @index);
&-@{value} {
@{property}: @value;
}
}
// Weights
.weight {
@list: normal, bold;
.list-properties(font-weight, @list);
}
// Styles
.style {
@list: normal, italic;
.list-properties(font-style, @list);
}
// Alignment
.align {
@list: left, right, center, justify;
.list-properties(text-align, @list);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment