0
0
SASSmarkup~5 mins

Importing built-in modules with @use 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 a Sass module and makes its variables, mixins, and functions available in the current file with a namespace.
Click to reveal answer
beginner
How do you import a built-in Sass module like <code>math</code>?
You write <code>@use "sass:math";</code> at the top of your Sass file to import the built-in <code>math</code> module.
Click to reveal answer
intermediate
Why is it better to use @use instead of @import in Sass?
@use loads modules only once and avoids naming conflicts by using namespaces, making your stylesheets easier to maintain and faster to compile.
Click to reveal answer
beginner
How do you call the pow function from the math module after importing it with @use "sass:math";?
You call it with the namespace like this: math.pow(2, 3) which calculates 2 to the power of 3.
Click to reveal answer
intermediate
Can you rename a built-in module namespace when using @use? How?
Yes, you can rename it by adding as followed by the new name, for example: @use "sass:math" as m; then use m.pow(2, 3).
Click to reveal answer
Which syntax correctly imports the built-in Sass color module?
A@use "sass:color";
B@import "color";
C@use "color";
D@import "sass:color";
After @use "sass:math";, how do you call the sqrt function?
Asqrt(9)
Bmath.sqrt(9)
Csass.math.sqrt(9)
Duse.math.sqrt(9)
What is a benefit of using @use over @import in Sass?
AIt loads modules multiple times
BIt disables variables
CIt avoids naming conflicts with namespaces
DIt removes all styles
How do you rename the namespace of the math module to m?
A@use "sass:math" as m;
B@use "sass:math" rename m;
C@import "sass:math" as m;
D@use "math" as m;
Which of these is NOT a built-in Sass module?
Asass:math
Bsass:list
Csass:color
Dsass:layout
Explain how to import and use a built-in Sass module with @use.
Think about the syntax and how you access module features.
You got /3 concepts.
    Why should you prefer @use over @import in modern Sass projects?
    Consider how @use handles namespaces and module loading.
    You got /3 concepts.