Skip to content

Instantly share code, notes, and snippets.

@eikeco
Created April 16, 2017 22:27
Show Gist options
  • Save eikeco/4b68eb6a5e19afdd92ccb77a438af28f to your computer and use it in GitHub Desktop.
Save eikeco/4b68eb6a5e19afdd92ccb77a438af28f to your computer and use it in GitHub Desktop.
/**
* Strip unit from given value
* @param {Number} $value Value to remove unit from
* @return {Number} Raw value without unit
*/
@function strip-unit($value) {
@if type-of($value) == 'number' and not unitless($value) {
@return $value / ($value * 0 + 1);
}
@return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment