Created
September 16, 2014 13:45
-
-
Save RichieAHB/5a807c6f93229308106c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// Sass (v3.4.4) | |
// Compass (v1.0.1) | |
// ---- | |
$px-only: true; | |
$pixelBase : 16; /* 1 */ | |
$visual-grid-breakpoints: ''; | |
$grid-columns: 12; | |
@mixin media($query:$feature $value $columns, $total-columns: $grid-columns) { | |
@if length($query) == 1 { | |
@media screen and ($default-feature: nth($query, 1)) { | |
$default-grid-columns: $grid-columns; | |
$grid-columns: $total-columns !global; | |
@content; | |
$grid-columns: $default-grid-columns !global; | |
} | |
} | |
@else { | |
$loopTo: length($query); | |
$mediaQuery: 'screen and '; | |
$default-grid-columns: $grid-columns; | |
$grid-columns: $total-columns !global; | |
@if length($query) % 2 != 0 { | |
$grid-columns: nth($query, $loopTo) !global; | |
$loopTo: $loopTo - 1; | |
} | |
$i: 1; | |
@while $i <= $loopTo { | |
$mediaQuery: $mediaQuery + '(' + nth($query, $i) + ': ' + nth($query, $i + 1) + ') '; | |
@if ($i + 1) != $loopTo { | |
$mediaQuery: $mediaQuery + 'and '; | |
} | |
$i: $i + 2; | |
} | |
@media #{$mediaQuery} { | |
@content; | |
$grid-columns: $default-grid-columns !global; | |
} | |
} | |
} | |
@function new-breakpoint($query:$feature $value $columns, $total-columns: $grid-columns) { | |
@if length($query) == 1 { | |
$query: $default-feature nth($query, 1) $total-columns; | |
} | |
@else if length($query) % 2 == 0 { | |
$query: append($query, $total-columns); | |
} | |
@if not belongs-to($query, $visual-grid-breakpoints) { | |
$visual-grid-breakpoints: append($visual-grid-breakpoints, $query, comma) !global; | |
} | |
@return $query; | |
} | |
@function parseInt($n) { | |
@return $n / ($n * 0 + 1); /* 2 */ | |
} | |
@function u($values){ /* 3 */ | |
$list: (); /* 4 */ | |
@each $value in $values { /* 5 */ | |
$unit : unit($value); /* 6 */ | |
$val : parseInt($value); /* 2 */ | |
@if ($px-only) and ($unit == 'rem') { /* 7 */ | |
$list: append($list, ($val * $pixelBase) + px); /* 7 */ | |
} | |
@else if($unit == 'px') or ($unit == 'rem'){ /* 8 */ | |
$list: append($list, $value); /* 8 */ | |
} | |
@else { | |
@warn 'There is no unit conversion for #{$unit}'; /* 9 */ | |
} | |
} | |
@return $list(); /* 10 */ | |
} | |
$desktopW: u(120rem); // reffers to desktop container size 120rem ie 1200px | |
$desktop: new-breakpoint(min-width $desktopW 12); // this is breakpoint for desktops | |
body { | |
width: 100%; | |
@include media($desktop) { | |
width: $desktopW; | |
} | |
} |
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
/* 1 */ | |
body { | |
width: 100%; | |
} | |
@media screen and (min-width: 1920px) { | |
body { | |
width: 1920px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment