Last active
August 29, 2015 14:20
-
-
Save jakob-e/2f76976c2816bd3e0cb9 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.3.14) | |
| // Compass (v1.0.1) | |
| // ---- | |
| @mixin gf($arglist.../* | |
| $name: quoted/unquoted string | |
| $weight: number or list | |
| $style: | |
| $subset: | |
| $text: | |
| */){ | |
| $map: keywords($arglist); | |
| $name:(); | |
| $weight:(); | |
| $style:(); | |
| $subset:(); | |
| $text:''; | |
| @if not length($arglist){ /* Combine */ } | |
| // We did not use keywords | |
| @if inspect($map) == '()' { | |
| // Parse values | |
| // Do not use each – it will return list items | |
| // individually | |
| // First item is always font name | |
| // $name: inspect(unquote(nth($arglist, 1))); | |
| // Loop through the remaining argument list | |
| @for $i from 1 through length($arglist) { | |
| $arg: nth($arglist, $i); | |
| @if type-of($arg) == string { | |
| } | |
| // Single number | |
| @if type-of($arg) == number { | |
| $weight: append($weight, $arg, comma); | |
| } | |
| @if type-of($arg) == list { | |
| // Loop through argument item list | |
| @for $j from 1 through length($arg) { | |
| $item: nth($arg, $j); | |
| $item: if(type-of($item) == list, inspect($item), $item); | |
| @if index(100 200 300 400 500 600 700 800 900, $item) { | |
| $weight: append($weight, $item, comma); | |
| } | |
| @elseif index('normal' 'italic' 'oblique', to-lower-case($item)) { | |
| $style: append($style, to-lower-case($item), comma); | |
| } | |
| // Subset names are not found in font names | |
| @elseif index('arabic' 'cyrillic' 'cyrillic-ext' 'devanagari' 'greek' 'greek-ext' 'hebrew' | |
| 'khmer' 'latin' 'latin-ext' 'telugu' 'vietnamese', to-lower-case($item)) { | |
| $subset: append($subset, to-lower-case($item), comma); | |
| } | |
| @else { | |
| $name: append($name, $item, comma); | |
| } | |
| } | |
| // Remove faulty subset names from name | |
| } | |
| } | |
| /* $name:`#{inspect($name)}` length: `#{length($name)}`*/ | |
| /* $weight:`#{inspect($weight)}` length: `#{length($weight)}`*/ | |
| /* $style:`#{inspect($style)}` length: `#{length($style)}` */ | |
| /* $subset:`#{inspect($subset)}` length: `#{length($subset)}`*/ | |
| } | |
| } | |
| @include gf('Open sans' 'Lato', 300 400, 'normal' 'italic', 'Xlatin' 'arabxic' 'dansk'); | |
| @include gf(Lato, 300 400, normal italic, 'latin' arabxic dansk); | |
| @include gf((Foo Bar, FII), 300 400, normal italic, 'latin' arabxic dansk); | |
| @include gf($name: Open sans); | |
| $google-font-subsets: ( | |
| 'arabic' :false | |
| , 'cyrillic' :false | |
| , 'cyrillic-ext':false | |
| , 'devanagari' :false | |
| , 'greek' :false | |
| , 'greek-ext' :false | |
| , 'hebrew' :false | |
| , 'khmer' :false | |
| , 'latin' :false | |
| , 'latin-ext' :false | |
| , 'telugu' :false | |
| , 'vietnamese' :false | |
| ); |
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
| /* $name:`"Open sans", "Lato", "Xlatin", "arabxic", "dansk"` length: `5`*/ | |
| /* $weight:`300, 400` length: `2`*/ | |
| /* $style:`"normal", "italic"` length: `2` */ | |
| /* $subset:`()` length: `0`*/ | |
| /* $name:`arabxic, dansk` length: `2`*/ | |
| /* $weight:`300, 400` length: `2`*/ | |
| /* $style:`normal, italic` length: `2` */ | |
| /* $subset:`("latin",)` length: `1`*/ | |
| /* $name:`Foo Bar, FII, arabxic, dansk` length: `4`*/ | |
| /* $weight:`300, 400` length: `2`*/ | |
| /* $style:`normal, italic` length: `2` */ | |
| /* $subset:`("latin",)` length: `1`*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment