0
0
SASSmarkup~20 mins

@import to @use migration in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Sass Module Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why migrate from @import to @use in Sass?
What is the main benefit of using @use instead of @import in Sass?
AIt automatically minifies the CSS output.
BIt allows importing CSS files directly without processing.
CIt disables Sass nesting features for simpler code.
DIt prevents variable and mixin conflicts by creating a namespace.
Attempts:
2 left
💡 Hint
Think about how Sass handles variables and mixins when importing multiple files.
📝 Syntax
intermediate
2:00remaining
Correct @use syntax for loading a file
Which option shows the correct way to load a Sass file named _buttons.scss using @use?
A@use 'buttons';
B@use buttons;
C@use 'buttons.scss';
D@use '_buttons.scss';
Attempts:
2 left
💡 Hint
Remember that Sass automatically looks for partial files starting with an underscore.
rendering
advanced
2:00remaining
Output difference between @import and @use
Given these files:

// _colors.scss $primary: blue;
// style.scss @import 'colors'; body { color: $primary; }

What happens if you replace @import with @use without changing the rest?
AThe code throws an error because $primary is undefined.
BThe code compiles but $primary is ignored, so body has no color.
CThe code works and colors the body blue.
DThe code compiles but colors the body red by default.
Attempts:
2 left
💡 Hint
Think about how variables are accessed with @use.
selector
advanced
2:00remaining
How to access variables from a @use module
If you have @use 'colors'; in your Sass file, how do you use the variable $primary defined inside _colors.scss?
AUse <code>$primary</code> directly without prefix.
BUse <code>colors.$primary</code> to access the variable.
CUse <code>@include colors.$primary;</code> to access it.
DUse <code>colors-primary</code> as a CSS class.
Attempts:
2 left
💡 Hint
Remember that @use creates a namespace.
accessibility
expert
3:00remaining
Ensuring accessibility when migrating from @import to @use
When migrating Sass files from @import to @use, what should you do to maintain accessible color contrast in your CSS variables?
AIgnore variable changes since <code>@use</code> does not affect accessibility.
BRemove all color variables and hardcode colors in CSS for better accessibility.
CUpdate all variable references to use the module namespace and verify color contrast ratios remain accessible.
DUse <code>@forward</code> instead of <code>@use</code> to keep variables global.
Attempts:
2 left
💡 Hint
Think about how variable renaming might affect your styles and accessibility.