CodeZettaInterview Hub

SCSS · Variables · Fresh / Intern · Concept

How does variable scope work in SCSS?

Short Interview Answer

Variables are local to the block where defined unless marked !global; nested rules create local scopes.

Detailed Explanation

Accidentally shadowing a global $color inside a mixin/nest is a common bug. Prefer module system (@use) with explicit namespaces over globals.

Common Mistake

Relying on leaky global $variables across files without @use.

Did you know this answer?