Skip to content

Instantly share code, notes, and snippets.

@jakob-e
Created January 3, 2015 19:21
Show Gist options
  • Save jakob-e/439334460b74788fc451 to your computer and use it in GitHub Desktop.
Save jakob-e/439334460b74788fc451 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
// [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ]
$__merge-map__: ();
$__merge__: false;
@mixin merge {
$__merge__: true !global;
$__merge-map__: () !global;
@content;
@each $key, $value in $__merge-map__{ #{$key}: $value; }
$__merge__: false !global;
}
@mixin render($arglist...){
$map: keywords($arglist);
@if $__merge__ { $__merge-map__: map-merge($__merge-map__, $map) !global; }
@else { @each $key, $value in $map{ #{$key}: $value; }
}
}
/*
font =>
$font-style: normal
$font-variant: normal
$font-weight: normal
$font-size: $base-font-size
$line-height: $base-line-height
$font-family: sans-serif
*/
$base-font-size: 16px;
@mixin font(
$font : null, // shorthand
$font-style : null, // normal | italic | oblique | inherit
$font-variant: null, // normal | small-caps | inherit
$font-weight : null, // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
$font-size : $base-font-size,
$line-height : null, // maybe change this to $base-line-height
$font-family : sans-serif // generic: serif | sans-serif | monospace | cursive | fantacy
){
@if $font == null {
$font: #{$font-style $font-variant $font-weight $font-size+if($line-height,'/'+$line-height, '') $font-family };
}
@include render($font: $font);
}
p {
@include merge {
//@include font($font-size:12px, $line-height: 1.4, $font-weight: 300, $font-style: italic, $font-variant: small-caps);
@include render($font-size:12px, $line-height: 1.4, $font-weight: 300, $font-style: italic, $font-variant: small-caps);
@include render($font-size:42px);
}
}
/*
font =>
$font-style: normal
$font-variant: normal
$font-weight: normal
$font-size: $base-font-size
$line-height: $base-line-height
$font-family: sans-serif
*/
p {
font-size: 42px;
line-height: 1.4;
font-weight: 300;
font-style: italic;
font-variant: small-caps;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment