Sass·Sass from variables to a design system

Modules

Configure modules and control the public API with @forward.

Intermediate 13 min read Lesson 8 of 300 Challenge included
What you will be able to do
  • Use @use for a module’s own dependencies.
  • Use @forward to build a public entry point.
  • Use !default for configurable variables.
  • Hide private members with - or _ prefixes.

In plain English

A module is a file loaded with @use. @forward re-exports another module, optionally hiding internals. Use configuration with !default to theme a module without editing it.

_index.scssSCSS
@forward "tokens" show $brand, $space;
@forward "mixins" as mix-*;

// Another file:
// @use "theme" with ($brand: #e4472b);
Your turn

Forward selected members

Easy

Forward only $brand from tokens.

SCSS · starter
@forward "tokens";
Check your understanding before moving on.
Knowledge checkQuestion 1

What does @forward do?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 8 of 300 · 0% of course