Last active
November 10, 2015 23:25
-
-
Save dustinhorton/1dd2eb6a995b676204d6 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// Sass (v3.4.14) | |
// Compass (v1.0.3) | |
// ---- | |
@function map-fetch($map, $keys...) { | |
@each $key in $keys { | |
$map: map-get($map, $key); | |
} | |
@return $map; | |
} | |
@function map-depth($map) { | |
$level: 1; | |
@each $key, $value in $map { | |
@if type-of($value) == "map" { | |
$level: max(map-depth($value) + 1, $level); | |
} | |
} | |
@return $level; | |
} | |
$semibold: 600; | |
$light: 300; | |
$webfonts: ( | |
remind-proxima-nova: ( | |
name: 'remind-proxima-nova', | |
versions: ( | |
bold: ( | |
style: 'normal', | |
weight: 'bold' | |
), | |
semibold: ( | |
style: 'normal', | |
weight: $semibold | |
), | |
regular: ( | |
style: 'normal', | |
weight: 'normal' | |
), | |
regular_italic: ( | |
style: 'italic', | |
weight: 'normal' | |
), | |
light: ( | |
style: 'normal', | |
weight: $light | |
) | |
), | |
location: 's3', | |
), | |
remicons: ( | |
name: 'remicons', | |
versions: ( | |
regular: ( | |
style: 'normal', | |
weight: 'normal' | |
) | |
), | |
location: 'local' | |
), | |
); | |
@each $webfont in $webfonts { | |
//content: $webfont; | |
//@for $i from 1 through map-depth(map-fetch($webfonts, $webfont, versions)) { | |
@each $version in map-fetch($webfonts, $webfont, versions) { | |
@font-face { | |
$name: map-get($versions, name); | |
$location: map-get($webfonts, location); | |
font-family: $name; | |
font-weight: map-get($webfonts, weight); | |
@if $location == 'local' { | |
src: font-url('#{$name}/#{$name}.eot?') format('embedded-opentype'), | |
font-url('#{$name}/#{$name}.woff') format('woff'), | |
font-url('#{$name}/#{$name}.ttf') format('truetype'); | |
} | |
@elseif $location == 's3' { | |
src: url('//d3498ple9xfqkw.cloudfront.net/common/fonts/#{$name}/#{$name}.eot?') format('embedded-opentype'), | |
url('//d3498ple9xfqkw.cloudfront.net/common/fonts/#{$name}/#{$name}.woff2') format('woff2'), | |
url('//d3498ple9xfqkw.cloudfront.net/common/fonts/#{$name}/#{$name}.woff') format('woff'), | |
url('//d3498ple9xfqkw.cloudfront.net/common/fonts/#{$name}/#{$name}.ttf') format('truetype'); | |
} | |
} | |
} | |
} |
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
$map: null is not a map for `map-get' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment