Last active
December 30, 2015 22:49
-
-
Save arthurgouveia/7897204 to your computer and use it in GitHub Desktop.
Sass function to output a property, along with it's values, with REM or PX units, depending on the value of $px-only
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
| $font-size: 16; | |
| $px-only: true; | |
| @function u($values){ | |
| $list: (); | |
| @each $value in $values { | |
| @if $value == 'auto' { | |
| $list: append($list, $value); | |
| } | |
| @else { | |
| @if ($px-only) { | |
| $list: append($list, $value + px); | |
| } | |
| @else { | |
| $list: append($list, ($value/$font-size) + rem); | |
| } | |
| } | |
| } | |
| @return $list(); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This:
Generates this: