A Pen by Jeremy Levy on CodePen.
Created
April 16, 2018 13:57
-
-
Save Jlevyd15/5b2bb398f90454c5f7733924ff3bd612 to your computer and use it in GitHub Desktop.
less test
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
<div class="test">test div</div> | |
<div class="test-2">test div</div> |
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
/* define a global 'switch' */ | |
@switch: four; | |
/* define the cases here */ | |
.mixin(three;) { | |
color: green; | |
} | |
.mixin(four;) { | |
color: blue | |
} | |
/* this is like the funciton that takes the argument @_ */ | |
.mixin(@_;) { | |
display: block; | |
} | |
/* this is the main class that calls the function */ | |
.test { | |
.mixin(@switch); | |
} | |
/* less gaurds ----------------------------------------------------------- */ | |
// .four() { | |
// color: red; | |
// } | |
// .three() { | |
// color: blue; | |
// } | |
.test-2 { | |
.four() when (@switch=four) { | |
color: red; | |
} | |
.three() when (@switch=three) { | |
color: green; | |
} | |
.three(); | |
.four(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment