Skip to content

Instantly share code, notes, and snippets.

@jakob-e
Created May 4, 2015 08:43
Show Gist options
  • Save jakob-e/461fb455284741904252 to your computer and use it in GitHub Desktop.
Save jakob-e/461fb455284741904252 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// 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:'';
// We did not use keywords
@if inspect($map) == '()' {
// Parse values
// Do not use each – it will return list items
// individually
@if not length($arglist){ /* Combine */ }
// First item is always font name
$name: inspect(unquote(nth($arglist, 1)));
// Loop through the remaining argument list
@for $i from 2 through length($arglist) {
$arg: nth($arglist, $i);
@if type-of($arg) == string {
}
@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) {
$itm: nth($arg, $j);
@if index(100 200 300 400 500 600 700 800 900, $itm) {
$weight: append($weight, $itm, comma);
}
@elseif index('normal' 'italic' 'oblique', $itm) {
$style: append($style, $itm, comma);
}
@elseif index('arabic' 'cyrillic' 'cyrillic-ext' 'devanagari' 'freek' 'greek-ext' hebrew khmer latin latin-ext telugu vietnamese, $itm) {
$subset: append($subset, $itm, comma);
}
}
}
/* $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, 300 400, normal italic, 'latin' arabxic dansk);
@include gf($name: Open sans);
$google-font-subsets: (
'arabic' :false
, 'cyrillic' :false
, 'cyrillic-ext':false
, 'devanagari' :false
, 'freek' :false
, 'greek-ext' :false
, 'hebrew' :false
, 'khmer' :false
, 'latin' :false
, 'latin-ext' :false
, 'telugu' :false
, 'vietnamese' :false
);
/* $name:`Open sans` length: `1`*/
/* $weight:`300, 400` length: `2`*/
/* $style:`()` length: `0` */
/* $subset:`()` length: `0`*/
/* $name:`Open sans` length: `1`*/
/* $weight:`300, 400` length: `2`*/
/* $style:`normal, italic` length: `2` */
/* $subset:`()` length: `0`*/
/* $name:`Open sans` length: `1`*/
/* $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