question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conditionally apply mixins

See original GitHub issue

Currently, to conditionally do something, you have virtually 2 choices. 1.

if (disabledFeature) return;
  1. 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:open
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
sfPlayer1commented, Jul 31, 2020

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.

1reaction
jamierockscommented, Jul 31, 2020

Just use IMixinConfigPlugin, it trivial to use and standard across Mixin environments - no need to introduce a Fabric-specific concept for this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found