Skip to content

Instantly share code, notes, and snippets.

@scsskid
Created February 17, 2018 12:37
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 scsskid/2ebbc68e734f4ce1973f4c218a67f85a to your computer and use it in GitHub Desktop.
Save scsskid/2ebbc68e734f4ce1973f4c218a67f85a to your computer and use it in GitHub Desktop.
@mixin not($ignorList...) {
//if only a single value given
@if (length($ignorList) == 1){
//it is probably a list variable so set ignore list to the variable
$ignorList: nth($ignorList,1);
}
//set up an empty $notOutput variable
$notOutput: '';
//for each item in the list
@each $not in $ignorList {
//generate a :not([ignored_item]) segment for each item in the ignore list and put them back to back
$notOutput: $notOutput + ':not(#{$not})';
}
//output the full :not() rule including all ignored items
&#{$notOutput} {
@content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment