Conditionally apply mixins
See original GitHub issueCurrently, to conditionally do something, you have virtually 2 choices. 1.
if (disabledFeature) return;
- IMixinConfigPlugin. This is powerful, although slightly harder to use.
I think the mixin JSON could be extended to allow a condition to be passed next to the applicable mixin.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
LESS - Conditional Mixins - Tutorialspoint
LESS - Conditional Mixins, You can use the default function to match mixin with other mixing matches and create conditional mixins which look...
Read more >Optimize mixins with conditionals in Sass - OpenClassrooms
Start by typing @if . Then follow it up with your conditional statement: the lightness percentage is less than 25% and a set...
Read more >How can I conditionally add in a mixin to the current class on ...
This is a neat place to use metaclasses. You can put the custom-mixin-inclusion code in the meta, then your Sub classes don't need...
Read more >Sass: @if and @else
Conditional expressions may contain boolean operators ( and , or , not ). ... @use "sass:math"; @mixin triangle($size, $color, $direction) { height: 0; ......
Read more >Conditionally apply mixin if another mod is loaded/not loaded?
You're looking for a mixin plugin; I'm not aware of any good documentation but a good example is Adorn (and specify it in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We don’t (officially) support mixin plugins, they don’t work well with planned features like pre-baking bytecode edits and are too easy to mess up by loading classes that shouldn’t be at this stage.
Just use
IMixinConfigPlugin
, it trivial to use and standard across Mixin environments - no need to introduce a Fabric-specific concept for this.