Skip to content

Instantly share code, notes, and snippets.

@khamer
Created September 17, 2021 17:25
Show Gist options
  • Save khamer/617fb01ec14b87fb10fa2d34acb45faf to your computer and use it in GitHub Desktop.
Save khamer/617fb01ec14b87fb10fa2d34acb45faf to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
@mixin at($bp, $rule: min-width) {
@if map-has-key($breakpoints, $bp) {
$bp: map-get($breakpoints, $bp);
}
@media screen and (#{$rule}: $bp) {
@content;
}
}
@mixin at-each($map...) {
@each $bp, $arg in $map {
@if $arg {
@include at($bp) {
@content($arg);
}
} @else {
@content($bp);
}
}
}
$breakpoints: (
md: 616px,
md-1: 865px,
lg: 1000px,
xl: 1288px,
);
.heading {
@include at-each(2rem, md 2.25rem, lg 2.5rem, xl 3rem) using ($size) {
font-size: $size;
}
}
.heading {
font-size: 2rem;
}
@media screen and (min-width: 616px) {
.heading {
font-size: 2.25rem;
}
}
@media screen and (min-width: 1000px) {
.heading {
font-size: 2.5rem;
}
}
@media screen and (min-width: 1288px) {
.heading {
font-size: 3rem;
}
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment