Last active
August 29, 2015 14:23
-
-
Save eduardoboucas/435348b29b688445263d to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // Include Media (v1.3.0) | |
| // ---- | |
| @import "include-media"; | |
| @function getBreakpoints($targetName) { | |
| $json: '{'; | |
| $targetValue: map-get($breakpoints, $targetName); | |
| @each $name, $value in $breakpoints { | |
| @if $json != '{' { | |
| $json: $json + ', '; | |
| } | |
| $state: if($targetValue >= $value, true, false); | |
| $json: $json + '"#{$name}": #{$state}'; | |
| } | |
| $json: $json + '}'; | |
| @return $json; | |
| } | |
| @mixin exportBreakpoints() { | |
| @each $name, $value in $breakpoints { | |
| @include media('>=#{$name}') { | |
| body { | |
| content: getBreakpoints($name); | |
| } | |
| } | |
| } | |
| } | |
| @include exportBreakpoints(); | |
| /* | |
| function isBreakpointActive(breakpoint) { | |
| var breakpoints = readBreakpoints(); | |
| return breakpoints[breakpoint]; | |
| } | |
| function readBreakpoints() { | |
| var breakpoints = window.getComputedStyle(document.body).content.replace(/'/g, ''); | |
| return JSON.parse(breakpoints); | |
| } | |
| */ |
This file contains hidden or 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
| @media (min-width: 320px) { | |
| body { | |
| content: '{"phone": true, "tablet": false, "desktop": false}'; | |
| } | |
| } | |
| @media (min-width: 768px) { | |
| body { | |
| content: '{"phone": true, "tablet": true, "desktop": false}'; | |
| } | |
| } | |
| @media (min-width: 1024px) { | |
| body { | |
| content: '{"phone": true, "tablet": true, "desktop": true}'; | |
| } | |
| } | |
| /* | |
| function isBreakpointActive(breakpoint) { | |
| var breakpoints = readBreakpoints(); | |
| return breakpoints[breakpoint]; | |
| } | |
| function readBreakpoints() { | |
| var breakpoints = window.getComputedStyle(document.body).content.replace(/'/g, ''); | |
| return JSON.parse(breakpoints); | |
| } | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment