Skip to content

Instantly share code, notes, and snippets.

@gorillawit
Last active August 29, 2015 13:55
Show Gist options
  • Save gorillawit/8725283 to your computer and use it in GitHub Desktop.
Save gorillawit/8725283 to your computer and use it in GitHub Desktop.
Info on Sass lists
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
// determine list seperator: spaces or commas
$a-list: a b c d e;
$another-list: 1,2,3,4,5;
div {
a-list: list-separator($a-list);
another-list: list-separator($another-list);
}
//using "list-seperator" is useful for
//testing which type of list was used (say, in a mixin for example)
//set-nth returns a list($listYourAffecting, positionInList, whatToReplaceItWith) )
$a-third-list: set-nth($a-list, 5, f);
.thirdListClass{
a-third-list: $a-third-list;
// "f" is appended in the fifth postion of the original $a-list list
}
//use negative numbers for list placement to go from last item backward
.negativeClass{
test: nth($a-list, -3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment