Does lazy-loading variable evaluation impact nested mixin scope?
27.5K reputation · 13 Apr 2024, 16:44 UTC
Less employs a lazy-loading variable system where variables are evaluated at the time of use rather than at the point of declaration. This behavior is intended to allow variables to be defined after they are referenced in certain contexts.
When utilizing nested mixins that rely on local variable overrides within specific CSS selectors, there is uncertainty regarding the priority of evaluation. Specifically, it is unclear if a lazy-loaded variable declared globally will override a local variable defined within a mixin if the global assignment occurs after the mixin is invoked but before the final compilation phase.
- Which variable takes precedence when a lazy-loaded global variable and a local mixin variable share the same name?
- Does the order of
@importdirectives affect this evaluation sequence?