Forked from juanbrujo/sass-maps-index-iterator.css
Created
September 12, 2018 09:58
-
-
Save im-sad/0b9dcabce84860fe0b0fbdc0f75a9dae to your computer and use it in GitHub Desktop.
sass-maps loop with index iterator
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
/** | |
* output from sass-maps-index-iterator.scss | |
*/ | |
li:nth-of-type(1):before { | |
content: "english - hello"; | |
} | |
li:nth-of-type(2):before { | |
content: "spanish - hola"; | |
} | |
li:nth-of-type(3):before { | |
content: "deutsch - hallo"; | |
} | |
li:nth-of-type(4):before { | |
content: "french - bonjour"; | |
} | |
li:nth-of-type(5):before { | |
content: "gaelic - dia duit"; | |
} | |
li:nth-of-type(6):before { | |
content: "icelandic - hae"; | |
} | |
li:nth-of-type(7):before { | |
content: "italian - ciao"; | |
} |
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
$list: ( | |
"english": "hello", | |
"spanish": "hola", | |
"deutsch": "hallo", | |
"french": "bonjour", | |
"gaelic": "dia duit", | |
"icelandic": "hae", | |
"italian": "ciao" | |
); | |
$list-length: length($list); | |
@for $i from 1 through $list-length { | |
$iterator: nth($list, $i); | |
$key: nth($iterator, 1); | |
$value: nth($iterator, 2); | |
li:nth-of-type(#{$i}):before { | |
content: $key + " - " + $value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment