0
0
SASSmarkup~20 mins

@use directive for imports in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Sass @use Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the @use directive syntax
Which of the following is the correct way to import a Sass module named colors using the @use directive?
A@use colors;
B@import 'colors';
C@use 'colors';
D@use('colors');
Attempts:
2 left
💡 Hint
Remember that @use requires quotes around the module name and no parentheses.
📝 Syntax
intermediate
2:00remaining
What error does this Sass code raise?
Consider this Sass code:
@use 'variables' as *;

What error will this code produce when compiled?
SASS
@use 'variables' as *;
ANo error, imports all variables without namespace
BWarning: Deprecated syntax
CRuntimeError: Module not found
DSyntaxError: Invalid namespace alias '*'
Attempts:
2 left
💡 Hint
The as * syntax is valid and imports members without requiring a namespace prefix.
rendering
advanced
2:00remaining
What color will the button background be?
Given these Sass files:

_colors.scss
$primary-color: #3498db;

styles.scss
@use 'colors';

button {
  background-color: colors.$primary-color;
}

What color will the button background be when rendered in the browser?
SASS
@use 'colors';

button {
  background-color: colors.$primary-color;
}
AA blue color (#3498db)
BTransparent (no color applied)
CBlack (default fallback)
DCompilation error due to wrong variable reference
Attempts:
2 left
💡 Hint
Variables imported with @use require the namespace prefix.
selector
advanced
2:00remaining
Which option correctly changes the namespace alias?
You want to import the mixins module but use the namespace m instead of mixins. Which @use statement is correct?
A@use 'mixins' with m;
B@use 'mixins' as m;
C@use 'mixins' namespace m;
D@use 'mixins' alias m;
Attempts:
2 left
💡 Hint
The as keyword changes the namespace alias.
accessibility
expert
3:00remaining
How does using @use improve maintainability and accessibility in large Sass projects?
Select the best explanation of how the @use directive helps maintain accessibility and clarity in large Sass codebases.
A<p>By enforcing namespaces, <code>@use</code> prevents variable and mixin name conflicts, making styles easier to manage and reducing errors that can affect accessibility.</p>
B<p><code>@use</code> automatically adds ARIA attributes to components for accessibility.</p>
C<p><code>@use</code> compiles CSS faster, improving page load times and accessibility.</p>
D<p><code>@use</code> disables unused CSS rules to reduce clutter and improve screen reader performance.</p>
Attempts:
2 left
💡 Hint
Think about how namespaces help avoid confusion and bugs.