Challenge - 5 Problems
Sass Module Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why migrate from @import to @use in Sass?
What is the main benefit of using
@use instead of @import in Sass?Attempts:
2 left
💡 Hint
Think about how Sass handles variables and mixins when importing multiple files.
✗ Incorrect
The @use rule loads Sass files with their own namespace, preventing conflicts between variables and mixins from different files. This is a key improvement over @import, which merges all files into one global scope.
📝 Syntax
intermediate2:00remaining
Correct @use syntax for loading a file
Which option shows the correct way to load a Sass file named
_buttons.scss using @use?Attempts:
2 left
💡 Hint
Remember that Sass automatically looks for partial files starting with an underscore.
✗ Incorrect
When using @use, you omit the underscore and file extension. Sass finds _buttons.scss automatically.
❓ rendering
advanced2:00remaining
Output difference between @import and @use
Given these files:
What happens if you replace
// _colors.scss
$primary: blue;// style.scss
@import 'colors';
body { color: $primary; }What happens if you replace
@import with @use without changing the rest?Attempts:
2 left
💡 Hint
Think about how variables are accessed with
@use.✗ Incorrect
With @use, variables are namespaced. You must write colors.$primary to access it. Using just $primary causes an error.
❓ selector
advanced2: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?Attempts:
2 left
💡 Hint
Remember that
@use creates a namespace.✗ Incorrect
Variables inside a @use module must be accessed with the module name as a prefix, like colors.$primary.
❓ accessibility
expert3: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?Attempts:
2 left
💡 Hint
Think about how variable renaming might affect your styles and accessibility.
✗ Incorrect
When migrating, you must update variable references to include the namespace. This ensures your styles use the correct colors. Then, check that color contrast ratios still meet accessibility standards.