Write maintainable CSS with variables, nesting, mixins, modules, maps, and compiled output.
Lessons
Validate inputs and log messages during compilation.
@error, @warn and @debug is easiest to learn by reading the example, changing it, and observing the result.
@function spacing($step) {
@if type-of($step) != number {
@error "spacing() expects a number, got #{$step}";
}
@if $step > 10 {
@warn "Large spacing step: #{$step}";
}
@return $step * 4px;
}
@debug spacing(3); // prints 12px during compilePractice the @error, @warn and @debug example in a small scratch file, then explain what changed and why.