Skip to content

Instantly share code, notes, and snippets.

@Snugug
Created August 9, 2015 11:47
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 Snugug/2fa73e6033ab96d37318 to your computer and use it in GitHub Desktop.
Save Snugug/2fa73e6033ab96d37318 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
$EQ-Selectors: ();
@mixin EQSTATECHECK($states, $name) {
$EQ-Error: 'You need to include a state for the `#{$name}` mixin!';
@if (length($states) == 0) {
@if feature-exists(at-error) {
@error $EQ-Error;
}
@else {
@warn $EQ-Error;
}
}
@else {
@content;
}
}
@mixin eq($states...) {
@include EQSTATECHECK('eq', $states) {
//////////////////////////////
// Markup based Element Queries
//////////////////////////////
$extend: unique-id();
@at-root {
%#{$extend} {
@content;
}
}
@each $state in $states {
&[data-eq-state$="#{$state}"] {
@extend %#{$extend};
}
}
}
}
.foo {
@include eq('small', 'medium') {
content: 'bar';
}
}
.foo[data-eq-state$="small"], .foo[data-eq-state$="medium"] {
content: 'bar';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment