Skip to content

Instantly share code, notes, and snippets.

@dustinhorton
Last active November 10, 2015 23:25
Show Gist options
  • Save dustinhorton/1dd2eb6a995b676204d6 to your computer and use it in GitHub Desktop.
Save dustinhorton/1dd2eb6a995b676204d6 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// 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');
}
}
}
}
$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