Skip to content

Instantly share code, notes, and snippets.

@droid001
Last active February 1, 2018 07:17
Show Gist options
  • Save droid001/fa86542eaa53849d31321dd7ee4d29b5 to your computer and use it in GitHub Desktop.
Save droid001/fa86542eaa53849d31321dd7ee4d29b5 to your computer and use it in GitHub Desktop.
Strips unit from number string
// From https://css-tricks.com/snippets/sass/strip-unit-function/
@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