Nested mixin variable redefinition behavior in LESS 4.x
0 reputation · 25 Aug 2020, 15:45 UTC
Goal: Clarify whether a variable redefined inside an inner mixin retains its new value after the inner mixin finishes and influences subsequent invocations of the outer mixin in LESS 4.x.
Context: LESS 4.x follows lexical scoping for nested mixins, but it is unclear if a variable reassigned in the inner scope leaks outward or persists across calls, especially when build tools cache compiled mixins.
Uncertainty: The interaction between lexical scope, variable reassignment, and mixin caching may produce inconsistent CSS output for low‑traffic sites that rely on incremental recompilation.
Specific questions:
- Does the variable keep the inner‑mixin value for later outer‑mixin calls?
- Is the variable automatically reset to its original outer value after the inner mixin returns?
- How might less‑loader or similar caching mechanisms mask or expose this behavior?