Skip to content

Instantly share code, notes, and snippets.

@shadowmint
Created April 29, 2014 03:54
Show Gist options
  • Save shadowmint/11390309 to your computer and use it in GitHub Desktop.
Save shadowmint/11390309 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// ----
$mqsupport: true;
$static-bp: tablet;
$breakpoints: (
mobile: (false, 100),
tablet: (100, 200),
desktop: (200, false)
);
@function has_max($point) {
$rtn: length(map_get($breakpoints, $point)) == 2;
@if $rtn {
@if nth(map_get($breakpoints, $point), 2) == false {
$rtn: false;
}
}
@return $rtn;
}
@function has_min($point) {
$rtn: length(map_get($breakpoints, $point)) >= 1;
@return $rtn and nth(map-get($breakpoints, $point), 1);
}
@function min($point) {
@return nth(map_get($breakpoints, $point), 1);
}
@function max($point) {
@return nth(map_get($breakpoints, $point), 2);
}
@mixin break($point) {
@if $mqsupport {
@if has_max($point) and has_min($point) {
@media (max-width:min($point)) and (min-width:max($point)) {
@content;
}
}
@else if has_max($point) {
@media (max-width:max($point)) {
@content;
}
}
@else if has_min($point) {
@media (min-width:min($point)) {
@content;
}
}
}
@else {
@if $point == $static-bp {
@content;
}
}
}
@mixin nomq() {
@if not $mqsupport {
@content
}
}
.body {
@include break(mobile) {
width: 50%;
}
@include break(tablet) {
width: 100%;
}
@include break(desktop) {
width: 10%;
}
}
@include nomq {
.lt-e9 {
background: #f00;
}
}
@media (max-width: 100) {
.body {
width: 50%;
}
}
@media (max-width: 100) and (min-width: 200) {
.body {
width: 100%;
}
}
@media (min-width: 200) {
.body {
width: 10%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment