Last active
June 5, 2017 11:10
-
-
Save whatjackhasmade/2e24799055dcd344ea7ad1a557a8ce89 to your computer and use it in GitHub Desktop.
Mixin - Not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*///////////////////////////////////////// | |
/// NOT | |
*///////////////////////////////////////// | |
@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