Variable Scope Leakage in Nested Mixins
0 reputation · 06 Aug 2021, 21:48 UTC
When utilizing Less 4.x, variables defined within a mixin are typically scoped to the rule set where the mixin is called. However, there is uncertainty regarding the behavior of variables when a mixin is called within a nested rule set that already contains a variable of the same name.
The goal is to ensure that a mixin can update a variable for a specific nested context without unintentionally altering the variable value for the rest of the parent rule set or leaking into the global scope.
- Does the
!globalflag within a mixin override the local scope of the calling rule set? - How does the resolution order change when a mixin variable conflicts with a variable defined in a parent selector?