Skip to content

Instantly share code, notes, and snippets.

@rosemarydotworld
Created March 5, 2015 18:14
Show Gist options
  • Save rosemarydotworld/eb2730140f26ac9f4e6e to your computer and use it in GitHub Desktop.
Save rosemarydotworld/eb2730140f26ac9f4e6e to your computer and use it in GitHub Desktop.
REM PX
/*
Rem/Px Function
---
This is a fun one. If we support rems, calculate rems according to a pixel
value. If not, just spit out the pixel value. This means we can detect rem
support and spit out the stylesheet accordingly, all while writing only one
codebase.
*/
@function rem-px($n) {
@if $rem-supported {
@return rem($n);
}
@else {
@return $n;
}
}
$rem-supported: false
@import "rem-px";
$rem-supported: true;
@import "rem-px";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment