0
0
SASSmarkup~20 mins

Design token management in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Design Token Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
What is the output CSS of this Sass variable usage?
Given the Sass code below, what will be the rendered CSS for the .button class?
SASS
$primary-color: #3498db;

.button {
  background-color: $primary-color;
  color: white;
}
A
.button {
  background-color: blue;
  color: white;
}
B
.button {
  background-color: $primary-color;
  color: white;
}
C
.button {
  background-color: #000000;
  color: white;
}
D
.button {
  background-color: #3498db;
  color: white;
}
Attempts:
2 left
💡 Hint
Sass variables are replaced with their values during compilation.
🧠 Conceptual
intermediate
2:00remaining
Which Sass feature helps manage design tokens for colors and spacing?
You want to keep your design tokens like colors and spacing organized and reusable in Sass. Which feature is best suited for this?
AWriting all tokens as separate global variables without grouping
BUsing Sass maps to group tokens by category
CUsing Sass mixins only for tokens
DUsing plain CSS variables inside Sass files
Attempts:
2 left
💡 Hint
Think about grouping related values together for easy access.
selector
advanced
2:00remaining
What CSS selector is generated by this Sass nesting with design tokens?
Consider the Sass code below using design tokens. What is the final CSS selector for the nested rule?
SASS
$colors: (
  primary: #3498db
);

.button {
  background-color: map-get($colors, primary);
  &:hover {
    background-color: darken(map-get($colors, primary), 10%);
  }
}
A.button > hover
B.button .hover
C.button:hover
D.button:hovered
Attempts:
2 left
💡 Hint
The ampersand (&) represents the parent selector in Sass nesting.
layout
advanced
2:00remaining
How to use design tokens with Flexbox in Sass for responsive layout?
You have spacing tokens in Sass and want to create a flex container with consistent gaps. Which Sass code correctly applies the spacing token as gap in a flex container?
SASS
$spacing: (
  small: 1rem,
  medium: 2rem
);

.container {
  display: flex;
  gap: map-get($spacing, medium);
}
A
.container {
  display: flex;
  gap: 2rem;
}
B
.container {
  display: flex;
  gap: $spacing.medium;
}
C
.container {
  display: flex;
  gap: map-get($spacing, small);
}
D
.container {
  display: flex;
  gap: 1rem;
}
Attempts:
2 left
💡 Hint
Remember how to get values from Sass maps and how they compile.
accessibility
expert
3:00remaining
How to use design tokens in Sass to ensure accessible color contrast?
You have design tokens for colors in Sass. Which approach best helps maintain accessible color contrast between text and background using these tokens?
ADefine separate tokens for background and text colors ensuring contrast ratios, then use them together in styles
BUse the same color token for both background and text to keep consistency
COnly define background color tokens and let text color be black by default
DUse random colors from tokens without checking contrast
Attempts:
2 left
💡 Hint
Accessibility requires good contrast between text and background colors.