Skip to content

Instantly share code, notes, and snippets.

@zellwk
Created August 4, 2015 09:53
Show Gist options
  • Select an option

  • Save zellwk/a52b0a32a14b902169e4 to your computer and use it in GitHub Desktop.

Select an option

Save zellwk/a52b0a32a14b902169e4 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$base-font-size: 16px;
$base-line-height: 24px;
@mixin font-size($font-size, $rem-sizing: true, $line-height: true) {
font-size: $font-size;
@if $rem-sizing == true {
font-size: calculate-rem($font-size);
}
@if $line-height == true {
line-height: calculate-line-height($font-size);
}
}
@function calculate-rem($font-size) {
$rem-size: ($font-size / $base-font-size) * 1rem;
@return $rem-size;
}
@function calculate-line-height($font-size) {
$line-height-size: ceil($font-size / $base-line-height) * ($base-line-height / $font-size);
@return $line-height-size;
}
@function strip-units($value) {
@return $value / ($value * 0 + 1);
}
//============
// Tests
//============
.testing {
@include font-size(24px);
}
.testing {
font-size: 24px;
font-size: 1.5rem;
line-height: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment