Skip to content

Instantly share code, notes, and snippets.

@cimmanon
Created August 8, 2014 16:56
Show Gist options
  • Save cimmanon/45c07f9aa6b2daa984be to your computer and use it in GitHub Desktop.
Save cimmanon/45c07f9aa6b2daa984be to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// Modular Scale (v2.0.5)
// ----
@import "modular-scale";
$font-base: 16px !default;
$font-scale: 1.5 !default;
// shouldn't need to modify these
$font-keywords: (xsmall: -2, small: -1, medium: 0, large: 1, xlarge: 2);
$fractional-units: em, rem, unquote('%'); // add as needed
@function size($keyword, $base: $font-base, $scale: $font-scale) {
$size: ms(map-get($font-keywords, $keyword), $base, $scale);
@return if(index($fractional-units, unit($base)), $size, round($size));
}
.foo {
a: size(medium);
b: size(small);
c: size(large, 1em);
d: size(xlarge, 1em);
f: size(xsmall, size(small));
}
.foo {
a: 16px;
b: 11px;
c: 1.5em;
d: 2.25em;
f: 5px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment