Skip to content

Instantly share code, notes, and snippets.

@toh82
Created September 18, 2014 12:13
Show Gist options
  • Select an option

  • Save toh82/10a9c8ec389d2229bce5 to your computer and use it in GitHub Desktop.

Select an option

Save toh82/10a9c8ec389d2229bce5 to your computer and use it in GitHub Desktop.
SCSS get value from List
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
$list: 10px, 15px, 20px;
@function getListEntry ($list, $index) {
@if length($list) >= $index {
@return nth($list, $index);
};
@return 0px;
}
.class1{
margin: getListEntry($list, 1)
}
.class1 {
margin: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment