Write maintainable CSS with variables, nesting, mixins, modules, maps, and compiled output.
Lessons
Know @use, @mixin, @include, @if, @each, and more.
Sass At-Rules Overview is easiest to learn by reading the example, changing it, and observing the result.
@use 'sass:map'; // load a module
@mixin badge($bg) { // define reusable styles
background: $bg;
}
$themes: (a: red, b: blue);
@each $name, $color in $themes { // loop
.badge-#{$name} { @include badge($color); }
}Practice the Sass At-Rules Overview example in a small scratch file, then explain what changed and why.