Created
March 5, 2015 18:14
-
-
Save rosemarydotworld/eb2730140f26ac9f4e6e to your computer and use it in GitHub Desktop.
REM PX
This file contains 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
/* | |
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; | |
} | |
} |
This file contains 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
$rem-supported: false | |
@import "rem-px"; |
This file contains 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
$rem-supported: true; | |
@import "rem-px"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment