meta.load($url, $with: null) loads the stylesheet at $url and returns a module value. The module is evaluated once, but no CSS is emitted until you ask for it with @include meta.css($module).
Load it with @use "sass:meta". Requires Dart Sass 1.105+.
Value, not include.
Unlike @use, meta.load() does not create a namespace. You keep the module in a variable and pass it to functions such as meta.module-variables() or meta.get-function(..., $module: $m).
$with configures !default variables.
Pass a map from variable names (no $) to values. It works only the first time a module is loaded.
Already loaded means locked.
If the same file was already loaded (by @use, @forward, or another meta.load), you cannot configure it again.
Syntax
Syntax
SCSS
@use "sass:meta";
meta.load($url, $with: null); //=> module
$theme: meta.load("theme");
$custom: meta.load("other", $with: ("primary": #c6538c));
@include meta.css($theme); // emit its CSS where you want
meta.module-variables($theme); // map of variables
// Module API — Dart Sass 1.105+
Pattern: meta.load → keep the module value → read members or @include meta.css to emit its CSS. Compare with meta.load-css() which loads and emits in one step.
Reference
load vs @use vs load-css
Three ways to bring a stylesheet in:
Tool
Gives you
CSS emitted
@use "url"
Namespace for members
Once, at the @use
meta.load($url)
A module value
No (until meta.css)
@include meta.load-css($url)
Nothing (CSS only)
Yes, where included
@include meta.css($module)
Nothing (CSS only)
Yes, each time it is included
Shorthand.
meta.load-css($url) is the same as meta.css(meta.load($url)).
Emits no CSS by itself—use meta.css() to output it.
$with configures!default variables on the first load.
Module values work as $module in other meta functions.
One line: use meta.load($url) when you want a stylesheet as a value instead of a namespace.
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:meta"
2. $m: meta.load("url") (no CSS yet)
3. Pass $with on the first load only
4. @include meta.css($m) to emit its CSS
5. Pass $m as $module to other meta functions
Frequently Asked Questions
meta.load($url, $with: null) loads the stylesheet at $url and returns a module value. It evaluates the stylesheet once but does not emit its CSS.
Use @include meta.css($module). The shorthand @include meta.load-css($url) loads and emits in one step.
@use creates a namespace for members and emits the CSS once. meta.load returns a module value, creates no namespace, and emits no CSS by itself.
Yes, with the $with map, but only on the first load. Once a module has been loaded it cannot be configured again.
Pass it as $module to meta.get-function(), meta.get-mixin(), meta.module-variables(), meta.module-functions(), or meta.module-mixins(), or include its CSS with meta.css().
Dart Sass 1.105 and later. LibSass and Ruby Sass do not provide first-class modules.