Skip to content

Instantly share code, notes, and snippets.

@MichaelArestad
Last active August 29, 2015 14:14
Show Gist options
  • Save MichaelArestad/a100ccdb74573ab2ef7a to your computer and use it in GitHub Desktop.
Save MichaelArestad/a100ccdb74573ab2ef7a to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
// ==========================================================================
// Breakpoint Mixin
// ==========================================================================
// Add or remove breakpoints as you desire
$breakpoints:(
S: 320px,
M: 600px,
L: 900px,
);
@mixin breakpoint( $size ){
@if type-of($size) == string {
@each $breakpoint, $value in $breakpoints {
@if $size == $breakpoint {
@media ( min-width: map-get( $breakpoints, $breakpoint ) + 1 ) {
@content;
}
}
$minus: $breakpoint + "-";
@if $size == $minus {
@media ( max-width: map-get( $breakpoints, $breakpoint ) ) {
@content;
}
}
}
} @else {
@media ( min-width: $size + 1 ) {
@content;
}
}
}
body {
@include breakpoint( S ){
content: S;
}
@include breakpoint( M ){
content: M;
}
@include breakpoint( L ){
content: L;
}
@include breakpoint( L- ){
content: L-;
}
@include breakpoint(150px){
content: custom;
}
}
@media (min-width: 321px) {
body {
content: S;
}
}
@media (min-width: 601px) {
body {
content: M;
}
}
@media (min-width: 901px) {
body {
content: L;
}
}
@media (max-width: 900px) {
body {
content: L-;
}
}
@media (min-width: 151px) {
body {
content: custom;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment