Last active
August 29, 2015 14:06
-
-
Save CraigChilds94/6566920c09cfe67c36ce to your computer and use it in GitHub Desktop.
A nice way to do breakpoints in Sass
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
// | |
// Primary breakpoints | |
// =================== | |
// Define the projects breakpoints here. Some sensible defualts are included. | |
// | |
/** | |
* Less than | |
* ========= | |
* | |
* @param $point - The value you're using in the breakpoint | |
*/ | |
@mixin less-than($point) { | |
@media (max-width: $point) { | |
@content; | |
} | |
} | |
/** | |
* More than | |
* ========= | |
* | |
* @param $point - The value you're using in the break point | |
*/ | |
@mixin more-than($point) { | |
@media (min-width: $point) { | |
@content; | |
} | |
} | |
/** | |
* Between two values | |
* ================== | |
* | |
* @param $min - The minimum value | |
* @param $max - The maximum value | |
*/ | |
@mixin between($min, $max) { | |
@media (min-width: $min) and (max-width: $max) { | |
@content; | |
} | |
} | |
/** | |
* Aliases below here | |
* ================== | |
*/ | |
// less-than() alias | |
@mixin lt($args...) { | |
@include less-than($args) { | |
@content; | |
} | |
} | |
// more-than() alias | |
@mixin mt($args...) { | |
@include more-than($args) { | |
@content; | |
} | |
} | |
// between() alias | |
@mixin bt($min, $max, $args...) { | |
@include between($min, $max, $args...) { | |
@content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment