
Lesson 07 · 11 min
@each and @if
Generate utilities like .mt-1… instead of writing them by hand. Don't write a whole program in Sass.
@each $name, $color in $palette { .text-#{$name} { color: $color; } }. @if $theme == dark { … }. This speeds up repetitive classes. A loop for the whole page layout means you're debugging a generator, not the interface. A map and 5 utilities are often enough.
Sign in to continue
The rest of this lesson opens after sign up
The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.