Skip to content

Instantly share code, notes, and snippets.

@khamer
Created April 8, 2021 13:56
Show Gist options
  • Save khamer/26aca3acad6d4becadf91126c7954669 to your computer and use it in GitHub Desktop.
Save khamer/26aca3acad6d4becadf91126c7954669 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
$breakpoints: (
md: 576px,
lg: 1024px,
xl: 1200px
) !default;
@mixin at($bp, $rule: min-width) {
@if map-has-key($breakpoints, $bp) {
$bp: map-get($breakpoints, $bp);
}
@media screen and (#{$rule}: $bp) {
@content;
}
}
@mixin bp-modifiers($breakpoints: $breakpoints, $prefix: '.-', $display: block) {
display: none;
@each $bp, $arg in $breakpoints {
@include at($bp) {
&.-\@#{nth($bp, 1)} {
display: $display;
}
}
}
}
.foo {
color: blue;
@include bp-modifiers;
}
.foo {
color: blue;
display: none;
}
@media screen and (min-width: 576px) {
.foo.-\@md {
display: block;
}
}
@media screen and (min-width: 1024px) {
.foo.-\@lg {
display: block;
}
}
@media screen and (min-width: 1200px) {
.foo.-\@xl {
display: block;
}
}
{
"sass": {
"compiler": "dart-sass/1.26.11",
"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