Last active
November 23, 2015 08:48
-
-
Save Vlasterx/d1e787bca72c8756e9d2 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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
$sizePx: 18px; | |
$basePx: 16px; | |
$unit--rem: true; | |
// CHECK BOOLEAN VALUE | |
@function bool($value: false) { | |
@if $value == false or | |
$value == "" or | |
$value == "false" or | |
$value == 'false' or | |
$value == 0 { | |
@return false; | |
} | |
@return true; | |
} | |
// Converts PX to REM based on base font size | |
@function rem($sizePx, $baseFontSizePx) { | |
@return ($sizePx / $baseFontSizePx) * 1rem; | |
} | |
// Font size mixin | |
@mixin font-size($sizePx, $basePx, $important: false) { | |
@if bool($important) == false { | |
font-size: round($sizePx); | |
@if bool($unit--rem) == true { font-size: rem($sizePx, $basePx); } | |
} | |
@else { | |
font-size: round($sizePx) !important; | |
@if bool($unit--rem) == true { font-size: rem($sizePx, $basePx) !important; } | |
} | |
} | |
// Test | |
.test { | |
@include font-size($sizePx, $basePx, true); | |
} |
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
.test { | |
font-size: 18px !important; | |
font-size: 1.125rem !important; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment