meta.module-mixins() belongs to the built-in sass:meta module. It returns every mixin in a @used module as a map of names to mixin values. This page covers the official stretch + meta.apply pattern, safe map.has-key guards, and five compiled examples.
01
Concept
Module mixin catalog
02
Module
@use "sass:meta"
03
Returns
Map of mixin values
04
$module
Must match a @use name
05
Include path
map.get + meta.apply
06
Practice
5 examples
Concept
What Is meta.module-mixins()?
Official docs: returns all the mixins defined in a module, as a map from mixin names to mixin values. Think of it as opening a style toolkit and seeing every recipe labeled by name—ready to pick one with map.get and include it with meta.apply.
$module must be a string matching a @use namespace in the current file.
Map keys are mixin names (strings). Map values are mixin values (not CSS yet).
Pair with meta.apply to emit CSS (and forward @content).
Dart Sass 1.69+ only—LibSass and Ruby Sass do not support it.
💡
Beginner tip
meta.mixin-exists asks “is there one recipe named stretch?” meta.module-mixins hands you the whole cookbook from that module.
Foundation
📝 Syntax
styles.scss
@use "sass:meta";
// Dart Sass 1.69+ (no legacy global name)
meta.module-mixins($module)
Parameters
Parameter
Type
Required
Description
$module
String
Yes
Must match the namespace of a @use rule in the current file.
When $name is present, meta.apply includes it. If the name were missing, the @else branch would keep a safe fallback.
Applications
🚀 Real-World Use Cases
Theme / plugin registries — discover mixins a module exports, then include by name.
Layout toolkits — pick stretch, center, or similar helpers from a catalog.
Documentation / debug peeks — print map.keys while building a design system.
Safe optional APIs — map.has-key before meta.apply.
Module inventories — count or loop members for code generation at compile time.
🧠 How Compilation Works
1
@use a mixins module
Load mixins (or another namespace) in the current file.
Source
2
Build the mixin map
Call meta.module-mixins("mixins").
Compile
3
Pick and apply
Use map.get + @include meta.apply (or loop the keys).
Include
4
✓
CSS ships
Browsers never see the map—only finished declarations.
Watch Out
⚠️ Common Pitfalls
Wrong namespace string — must match this file’s @use … as name exactly.
Module not loaded here — only @use rules in the current file count.
Confusing values with CSS — map values are mixin references until you meta.apply them.
Including without meta.apply — you cannot @include a map value directly; use meta.apply.
Older Dart Sass — needs 1.69+ (same family as get-mixin / apply).
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:meta" and meta.module-mixins()
Store the map once in a variable when applying several times
Guard optional names with map.has-key
Prefer map.keys / meta.inspect for readable peeks
Run Dart Sass 1.69+
❌ Don’t
Pass a path string that is not a current-file @use namespace
Expect map values to emit CSS without meta.apply
Use it to list functions or variables (use the sibling helpers)
Assume browsers evaluate the lookup
Rely on LibSass / Ruby Sass
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about meta.module-mixins()
Get every mixin in a @use module as a map, then apply what you need.
5
Core concepts
📝01
API
module-mixins($module)
Call
📦02
Module
sass:meta
@use
📚03
Returns
map of mixins
Result
🔗04
$module
@use namespace
Scope
✓05
Include
map.get + meta.apply
Tooling
❓ Frequently Asked Questions
meta.module-mixins($module) returns a map of every mixin defined in that @use module—keys are mixin names, values are mixin values you include with meta.apply.
A string matching the namespace of a @use rule in the current file—for example "mixins" after @use "mixins".
Official pattern: @include meta.apply(map.get(meta.module-mixins("mixins"), "stretch")). map.get picks the mixin value; meta.apply includes it.
mixin-exists answers yes/no for one name. module-mixins returns the whole catalog of mixins in a module as a map.
get-mixin looks up one mixin by name. module-mixins returns all mixins in a module at once—handy for registries, loops, and map.has-key guards.
Dart Sass 1.69+. LibSass and Ruby Sass do not. Prefer current Dart Sass.
Did you know?
Official Sass docs pair meta.module-mixins with map.get and meta.apply—the mixin twin of module-functions + meta.call, resolved entirely at compile time.
meta.module-mixins() returns a map of every mixin in a @used module. Match $module to that namespace, explore names with map.keys, and include helpers with map.get + meta.apply on Dart Sass 1.69+.