Created
August 31, 2017 09:30
-
-
Save maxxscho/6f70e51f9dbe3af3652a7d07f41d7310 to your computer and use it in GitHub Desktop.
Strips the unit of a value in SCSS
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
/// Remove the unit of a length | |
/// @param {Number} $number - Number to remove unit from | |
/// @return {Number} - Unitless number | |
@function strip-unit($number) { | |
@if type-of($number) == 'number' and not unitless($number) { | |
@return $number / ($number * 0 + 1); | |
} | |
@return $number; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment