Skip to content

Instantly share code, notes, and snippets.

@zastrow
Created February 2, 2021 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zastrow/3816cc024964087d3c365bd4f14678b7 to your computer and use it in GitHub Desktop.
Save zastrow/3816cc024964087d3c365bd4f14678b7 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
$media-queries: (
sm: 40rem,
lg: 80rem
);
@mixin loop-states {
&,
&\:hover:hover,
&\:active:active,
&\:focus:focus {
@content;
}
@each $key, $val in $media-queries {
// Checks that the media query is a number
@if $val != $val + "" {
@media (min-width: #{$val}) {
&\@#{$key},
&\:hover\@#{$key}:hover,
&\:active\@#{$key}:active,
&\:focus\@#{$key}:focus {
@content;
}
}
}
}
}
.this {
@include loop-states {
color: red;
}
}
.this, .this\:hover:hover, .this\:active:active, .this\:focus:focus {
color: red;
}
@media (min-width: 40rem) {
.this\@sm, .this\:hover\@sm:hover, .this\:active\@sm:active, .this\:focus\@sm:focus {
color: red;
}
}
@media (min-width: 80rem) {
.this\@lg, .this\:hover\@lg:hover, .this\:active\@lg:active, .this\:focus\@lg:focus {
color: red;
}
}
{
"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