Skip to content

Instantly share code, notes, and snippets.

@lunelson
Last active December 16, 2015 22:39
Show Gist options
  • Save lunelson/5508454 to your computer and use it in GitHub Desktop.
Save lunelson/5508454 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com, the Sass playground.
// two functions to deal with removing or setting units;
// aliased to strip() and assert() respectively
@function remove-unit($n) { @return $n / ($n * 0 + 1); }
@function strip($n) { @return remove-unit($n); }
@function set-unit($n, $u) { @return remove-unit($n) * 1#{$u}; }
@function assert($n, $u) { @return set-unit($n, $u); }
.test {
color: remove-unit(15%);
width: set-unit(100,px);
height: assert(200px,em);
margin: strip(100px) auto;
}
.test {
color: 15;
width: 100px;
height: 200em;
margin: 100 auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment