Skip to content

Instantly share code, notes, and snippets.

@Jlevyd15
Created April 16, 2018 13:57
Show Gist options
  • Save Jlevyd15/5b2bb398f90454c5f7733924ff3bd612 to your computer and use it in GitHub Desktop.
Save Jlevyd15/5b2bb398f90454c5f7733924ff3bd612 to your computer and use it in GitHub Desktop.
less test
<div class="test">test div</div>
<div class="test-2">test div</div>
/* 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