| 1 |
// Convert pixels to ems |
| 2 |
// eg. for a relational value of 12px write em(12) when the parent is 16px |
| 3 |
// if the parent is another value say 24px write em(12, 24) |
| 4 |
|
| 5 |
@function em($pxval, $base: $em-base) { |
| 6 |
@if $output-bourbon-deprecation-warnings == true { |
| 7 |
@warn "[Bourbon] [Deprecation] `em` is deprecated and will be " + |
| 8 |
"removed in 5.0.0."; |
| 9 |
} |
| 10 |
|
| 11 |
$user-deprecation-warnings-setting: $output-bourbon-deprecation-warnings; |
| 12 |
$output-bourbon-deprecation-warnings: false !global; |
| 13 |
|
| 14 |
@if not unitless($pxval) { |
| 15 |
$pxval: strip-units($pxval); |
| 16 |
} |
| 17 |
@if not unitless($base) { |
| 18 |
$base: strip-units($base); |
| 19 |
} |
| 20 |
|
| 21 |
$output-bourbon-deprecation-warnings: $user-deprecation-warnings-setting !global; |
| 22 |
|
| 23 |
@return ($pxval / $base) * 1em; |
| 24 |
} |