A module is a Sass stylesheet that has been loaded—by @use or as a built-in such as sass:math. It holds variables, functions, mixins, and CSS. With first-class modules a loaded module can also be a value you keep in a variable and pass around.
You get a module value two ways: meta.load() loads a stylesheet by URL, and meta.get-module() fetches one you already loaded with @use by its namespace.
Loading is not including.
meta.load() evaluates a stylesheet but emits no CSS by itself. Emit its CSS on purpose with @include meta.css($module), or use the shorthand meta.load-css().
Pass it to existing helpers.
A module value can be given as the $module argument of meta.get-function(), meta.get-mixin(), meta.module-variables(), meta.module-functions(), and meta.module-mixins().
Loaded once.
A module is evaluated only once. You cannot configure it with $with after it was already loaded, and meta.css() can emit its CSS each time you include it.
Does Sass have “hooks”?
No. Official Sass has no hooks API (nothing like theme hook files or lifecycle callbacks). When people say “hooks” for Sass they usually mean these customization points instead:
!default variables — a library exposes knobs; consumers override them before or while loading the module.
@use "lib" with ($primary: …) — configure those knobs the first time a module loads.
meta.load($url, $with: (...)) — the same configuration idea when you load a module as a value.
@forward + @use — re-export and compose library entrypoints without global pollution.
First-class mixins / functions — pass behavior around with meta.get-mixin(), meta.apply(), meta.get-function(), and meta.call().
Those five tools cover sharing, configuring, and swapping behavior. There is no separate hooks feature to learn beyond them.
Syntax
Syntax
SCSS
@use "sass:meta";
@use "theme"; // namespace: theme
$a: meta.get-module("theme"); // already-loaded module
$b: meta.load("theme"); // load by URL (no CSS yet)
$c: meta.load("theme", $with: ("primary": #c6538c));
@include meta.css($b); // emit its CSS here
@include meta.load-css("theme"); // shorthand: load + emit
meta.module-variables($a); // map of variables
meta.get-function("rem", $module: $a); // function from the module
Pattern: load or fetch a module → inspect or use its members → emit its CSS only where you want it.
Reference
Working with Module Values
Which tool to reach for:
Goal
Tool
Notes
Get a module already loaded
meta.get-module("namespace")
Uses the @use namespace
Load a stylesheet as a value
meta.load($url, $with)
Does not emit CSS
Emit a module’s CSS
@include meta.css($module)
Can appear anywhere, even nested
Load and emit in one step
@include meta.load-css($url)
Same output as css + load
List members
meta.module-variables / -functions / -mixins
Accept a module value
Reach one member
meta.get-function(..., $module:) / get-mixin
Accept a module value
No hooks feature.
Sass has no separate “hooks” system. Modules, @use configuration (with), and these meta functions are how stylesheets share and customise behavior.
meta.css(meta.load(...)) loads, then emits the CSS in place.
meta.load-css(...) is the shorthand for the same two steps.
Both nest the module’s CSS under the surrounding selector.
The module is evaluated once, so variables are shared.
Edge Cases & Pitfalls
Most module-value issues are namespace names, loading order, and expecting CSS from a plain load.
namespace
get-module needs the namespace
meta.get-module("theme") works only for modules loaded with @use in the current file. Use the alias if you wrote @use "theme" as t, and not the full URL.
css
Loading alone emits no CSS
meta.load() evaluates the stylesheet. Add @include meta.css($module) (or use meta.load-css()) to output its CSS.
with
Configure before the first load
A module that was already loaded—with or without configuration—cannot be loaded again with $with. The compiler reports it.
dup
Each meta.css repeats the CSS
@use emits a module’s CSS once. Every @include meta.css($m) emits it again where you put it.
Toolchain
Sass Support
First-class modules arrived in a recent Dart Sass release.
A module is a loaded stylesheet with variables, functions, mixins, and CSS.
meta.load() and meta.get-module() give you a module as a value.
Loading emits no CSS—use meta.css() or meta.load-css() to output it.
Module values plug into the existing meta functions via $module.
One line: load or fetch a module as a value, inspect its members, and emit its CSS only where you want it.
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:meta"
2. meta.get-module("namespace") for a @use'd module
3. meta.load("url", $with: (...)) to load by URL
4. @include meta.css($module) to emit its CSS
5. Pass the module as $module to get-function / get-mixin
Frequently Asked Questions
A module value is a first-class reference to a loaded stylesheet. It holds variables, functions, mixins, and CSS, and can be stored in a variable or passed to meta functions.
Use meta.get-module("namespace") for a module already loaded with @use, or meta.load("url") to load a stylesheet by URL.
No. It only evaluates the stylesheet. Use @include meta.css($module) to emit its CSS, or meta.load-css() to load and emit in one step.
Yes, with the $with map, for example meta.load("theme", $with: ("primary": #c6538c)). Only !default variables can be configured, and a module already loaded cannot be reconfigured.
Pass it as the $module argument of meta.get-function(), meta.get-mixin(), meta.module-variables(), meta.module-functions(), or meta.module-mixins().
No. Sass has no separate hooks feature. Modules, @use with configuration, and the meta module functions are how stylesheets share and customise behavior.