0
0
SASSmarkup~5 mins

Namespace control with @use as in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the @use rule do in Sass?
The @use rule loads another Sass file and makes its variables, mixins, and functions available with a namespace to avoid name conflicts.
Click to reveal answer
beginner
How do you change the namespace when using @use in Sass?
You can change the namespace by adding as newName after the file path, like @use 'colors' as c; which lets you access items with c.$variable.
Click to reveal answer
beginner
Why is namespace control important in Sass?
Namespace control helps avoid naming conflicts when multiple Sass files have variables or mixins with the same name, keeping styles organized and clear.
Click to reveal answer
intermediate
What happens if you use @use 'file' as *; in Sass?
Using as * imports all members without a namespace, making variables and mixins available directly but risking name conflicts.
Click to reveal answer
beginner
Show an example of using @use with a custom namespace.
Example:<br>
@use 'colors' as c;

.button {
  color: c.$primary-color;
}
This uses c as the namespace for the colors file.
Click to reveal answer
What does @use 'variables' as v; do in Sass?
ALoads variables with the namespace 'v'
BLoads variables without any namespace
CImports variables as global variables
DRemoves the variables file
Which of these is a risk when using @use 'file' as *;?
AName conflicts between variables
BFile not found error
CSlower compilation
DVariables become private
Why prefer @use over @import in Sass?
AThey are exactly the same
B<code>@import</code> is faster
C<code>@use</code> supports namespaces and avoids conflicts
D<code>@use</code> is deprecated
How do you access a variable named $color from a file loaded as @use 'theme' as t;?
A$color
Bt.$color
Ctheme.$color
Dcolor
What is the default namespace when using @use 'file'; without as?
AThe word 'use'
BNo namespace
CGlobal namespace
DThe file name
Explain how namespace control works with @use as in Sass and why it is useful.
Think about how you keep things organized when you have many files with similar names.
You got /4 concepts.
    Describe the difference between using @use 'file' as namespace; and @use 'file' as *; in Sass.
    Consider how you call variables after importing.
    You got /3 concepts.