Sass meta.module-functions() Function

Intermediate
⏱️ 12 min read
📚 Updated: Jul 2026
🎯 5 Examples
sass:meta · Dart Sass 1.23+

What You’ll Learn

meta.module-functions() belongs to the built-in sass:meta module. It returns every function in a @used module as a map of names to function values. This page covers the official pow + meta.call pattern, built-in modules like sass:math, and five compiled examples.

01

Concept

Module function catalog

02

Module

@use "sass:meta"

03

Returns

Map of function values

04

$module

Must match a @use name

05

Call path

map.get + meta.call

06

Practice

5 examples

What Is meta.module-functions()?

Official docs: returns all the functions defined in a module, as a map from function names to function values. Think of it as opening a toolbox and seeing every tool labeled by name—ready to pick one with map.get and run it with meta.call.

  • $module must be a string matching a @use namespace in the current file.
  • Map keys are function names (strings). Map values are function values (not computed results).
  • Works for your own modules and built-ins like sass:math after you @use them.
  • Dart Sass 1.23+ only—LibSass and Ruby Sass do not support it.
💡
Beginner tip

meta.function-exists asks “is there one tool named pow?” meta.module-functions hands you the whole drawer of tools from that module.

📝 Syntax

styles.scss
@use "sass:meta";

// Dart Sass 1.23+ (no legacy global name)
meta.module-functions($module)

Parameters

ParameterTypeRequiredDescription
$moduleStringYesMust match the namespace of a @use rule in the current file.

Return value

TypeResult
MapFunction names → function values (use with meta.call)

📦 Loading sass:meta

styles.scss
@use "sass:map";
@use "sass:meta";
@use "functions";

$fns: meta.module-functions("functions");
$result: meta.call(map.get($fns, "pow"), 3, 4); // 81

There is no legacy global module-functions(). Always load sass:meta and call meta.module-functions.

⚙ The Official Call Pattern

Docs show listing a custom module, then picking one function and running it:

styles.scss
@use "sass:map";
@use "sass:meta";
@use "functions";

// Map of names → function values
@debug meta.module-functions("functions");
// ("pow": get-function("pow"), …)

// Pick "pow" and call it: 3^4 = 81
@debug meta.call(map.get(meta.module-functions("functions"), "pow"), 3, 4);

If you wrote @use "functions" as fn, pass "fn" as $module.

📋 Related Meta Helpers

HelperPurposeReturns
meta.module-functionsAll functions in a moduleMap of function values
meta.module-mixinsAll mixins in a moduleMap of mixin values
meta.module-variablesAll variables in a moduleMap of values
meta.get-functionOne function by nameFunction value
meta.function-existsDoes one function exist?Boolean

🛠 Compatibility

This is about Sass compilers, not browsers. The map is built at compile time.

Implementationmodule-functions
Dart SassYes — since 1.23.0
LibSassNo
Ruby SassNo

Prefer current Dart Sass. Only Dart Sass supports this function.

⚡ Quick Reference

GoalCode
Import meta (+ map)@use "sass:meta"; @use "sass:map";
List a module’s functionsmeta.module-functions("functions")
See the namesmap.keys(meta.module-functions("math"))
Call one by namemeta.call(map.get($fns, "pow"), 3, 4)
Guard a name@if map.has-key($fns, $name) { … }
Single lookup insteadmeta.get-function("pow", $module: "math")

Examples Gallery

Each example uses meta.module-functions at compile time (Dart Sass 1.23+). Open View Compiled CSS for verified output.

📚 Getting Started

List a custom module, then call a function from the map (official style).

Example 1 — List Function Names in a Module

Inspect map.keys so beginners can see the catalog without printing function values.

styles.scss
@function pow($base, $exponent) {
  $result: 1;
  @for $_ from 1 through $exponent {
    $result: $result * $base;
  }
  @return $result;
}

@function double($n) {
  @return $n * 2;
}
styles.scss
@use "sass:map";
@use "sass:meta";
@use "functions";

$fns: meta.module-functions("functions");

.probe {
  --keys: #{meta.inspect(map.keys($fns))};
}

How It Works

module-functions returns the map; map.keys + meta.inspect peeks at the names for debugging or docs.

Example 2 — Official map.get + meta.call

Pick pow from the map and compute 34 = 81.

styles.scss
@use "sass:map";
@use "sass:meta";
@use "functions";

.result {
  width: meta.call(map.get(meta.module-functions("functions"), "pow"), 3, 4) * 1px;
}

How It Works

Matches the official docs: map.get(…, "pow") yields a function value; meta.call runs it with arguments 3 and 4.

📈 Practical Patterns

Built-in modules, counting members, and safe dynamic calls.

Example 3 — Probe sass:math

After @use "sass:math", use map.has-key on the catalog.

styles.scss
@use "sass:map";
@use "sass:meta";
@use "sass:math";

$math-fns: meta.module-functions("math");

.probe {
  --has-div: #{map.has-key($math-fns, "div")};
  --has-pow: #{map.has-key($math-fns, "pow")};
  --has-nope: #{map.has-key($math-fns, "nope")};
}

How It Works

Built-in modules work the same way: the string "math" must match the @use namespace in this file.

Example 4 — Count Functions in a Module

Combine map.keys with list.length for a simple inventory.

styles.scss
@use "sass:list";
@use "sass:map";
@use "sass:meta";
@use "functions";

$fns: meta.module-functions("functions");

.count {
  --n: #{list.length(map.keys($fns))};
}

How It Works

Our sample _functions.scss exports pow and double, so the count is 2.

Example 5 — Guard Before meta.call

Check map.has-key so optional plugin names fail safely.

styles.scss
@use "sass:map";
@use "sass:meta";
@use "functions";

$fns: meta.module-functions("functions");
$name: "double";

.box {
  @if map.has-key($fns, $name) {
    width: meta.call(map.get($fns, $name), 24px);
  } @else {
    width: 24px;
  }
}

How It Works

double(24px) returns 48px. If $name were missing, the @else branch would keep a safe fallback width.

🚀 Real-World Use Cases

  • Plugin registries — discover helpers a theme module exports, then call by name.
  • Dynamic math paths — pick math.div / math.pow from the catalog.
  • Documentation / debug peeks — print map.keys while building a design system.
  • Safe optional APIsmap.has-key before meta.call.
  • Module inventories — count or loop members for code generation at compile time.

🧠 How Compilation Works

1

@use a module

Load functions, sass:math, or another namespace.

Source
2

Build the function map

Call meta.module-functions("functions").

Compile
3

Pick and call

Use map.get + meta.call (or loop the keys).

Invoke
4

CSS ships

Browsers never see the map—only finished values and rules.

⚠️ 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 results — map values are function references, not already-computed numbers.
  • Calling without meta.call — you must run function values through meta.call.
  • Expecting LibSass — this API is Dart Sass only (1.23+).

💡 Best Practices

✅ Do

  • Use @use "sass:meta" and meta.module-functions()
  • Store the map once in a variable when calling several times
  • Guard optional names with map.has-key
  • Prefer map.keys / meta.inspect for readable peeks
  • Run Dart Sass 1.23+

❌ Don’t

  • Pass a path string that is not a current-file @use namespace
  • Expect map values to be CSS-ready numbers without meta.call
  • Use it to list mixins or variables (use the sibling helpers)
  • Assume browsers evaluate the lookup
  • Rely on LibSass / Ruby Sass

Key Takeaways

Knowledge Unlocked

Five things to remember about meta.module-functions()

Get every function in a @use module as a map, then call what you need.

5
Core concepts
📦 02

Module

sass:meta

@use
📚 03

Returns

map of functions

Result
🔗 04

$module

@use namespace

Scope
05

Invoke

map.get + meta.call

Tooling

❓ Frequently Asked Questions

meta.module-functions($module) returns a map of every function defined in that @use module—keys are function names, values are function values you can run with meta.call.
A string matching the namespace of a @use rule in the current file—for example "functions" after @use "functions", or "math" after @use "sass:math".
Official pattern: meta.call(map.get(meta.module-functions("functions"), "pow"), 3, 4). map.get picks the function value; meta.call runs it.
function-exists answers yes/no for one name. module-functions returns the whole catalog of functions in a module as a map.
get-function looks up one function by name. module-functions returns all functions in a module at once—handy for registries, loops, and map.has-key guards.
Dart Sass 1.23+. LibSass and Ruby Sass do not. Prefer current Dart Sass.
Did you know?

Official Sass docs pair meta.module-functions with map.get and meta.call—the same idea as a dynamic import of every function in a file, resolved entirely at compile time.

Conclusion

meta.module-functions() returns a map of every function in a @used module. Match $module to that namespace, explore names with map.keys, and run helpers with map.get + meta.call on Dart Sass 1.23+.

Continue with meta.module-mixins() or the Sass introduction.

Next: list module mixins

Learn meta.module-mixins() to get every mixin in a @use module as a map.

meta.module-mixins() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful