meta.get-function() belongs to the built-in sass:meta module. It turns a function name into a function value you can store, pass around, and run with meta.call. This page covers $module, $css, vs function-exists, and five compiled examples.
01
Concept
Name → function value
02
Module
@use "sass:meta"
03
Returns
Function value
04
Invoke
meta.call($fn, …)
05
Options
$module / $css
06
Practice
5 examples
Concept
What Is meta.get-function()?
Normally you write double(21) with a fixed name. Higher-order helpers need a reference to a function instead. Official docs: meta.get-function returns the function value named $name, and you invoke it with meta.call().
Without $module, looks up a function without a namespace (including many globals).
With $module, looks inside a @use namespace from the current file.
Default: missing Sass names throw. With $css: true, you get a plain CSS function instead.
💡
Beginner tip
get-function picks a tool from the toolbox. meta.call uses it. For mixins, the cousins are meta.get-mixin and meta.apply.
Foundation
📝 Syntax
styles.scss
@use "sass:meta";
// Recommended
meta.get-function($name, $css: false, $module: null)
// Legacy global name
get-function($name, $css: false, $module: null)
Parameters
Parameter
Type
Required
Description
$name
String
Yes
Function name to resolve (without parentheses).
$css
Boolean
No
Default false: missing Sass functions error. true: return a plain CSS function value instead.
$module
String or null
No
If set, must match a @use namespace in the current file.
Return value
Type
Result
Function
A Sass function value (or a plain CSS function when $css: true)
Modules
📦 Loading sass:meta
styles.scss
// Recommended — namespaced
@use "sass:meta";
@use "sass:math";
$fn: meta.get-function("abs", $module: "math");
$value: meta.call($fn, -8); // 8
// Optional — bring members into scope
@use "sass:meta" as *;
$fn: get-function("abs", $module: "math");
// Legacy global
$fn: get-function("abs", $module: "math");
Details
🔗 Pair with meta.call
Official rule: the returned function is called using meta.call(). Prefer this over the deprecated string form of call("name", …).
By default, an unknown Sass function name throws. Set $css: true when you want a plain CSS function value instead (for example to keep min / clamp as CSS at the call site).
$css
Missing Sass name
false (default)
Compile error
true
Returns a plain CSS function value
Compare
📋 Related Meta Helpers
Helper
Role
meta.function-exists
Boolean: is the function defined?
meta.get-function
Function value: resolve the reference
meta.call
Invoke a function value with arguments
meta.get-mixin + meta.apply
Same idea for mixins / CSS emission
Support
🛠 Compatibility
This is about Sass compilers, not browsers. Resolution runs at compile time.
Implementation
get-function
Dart Sass
Yes — prefer meta.get-function with modules
LibSass (3.5+)
Yes (function values; legacy pipelines)
Ruby Sass (3.5+)
Yes (function values; legacy pipelines)
Prefer current Dart Sass for @use and $module.
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import meta
@use "sass:meta";
Local function
meta.get-function("double")
Module function
meta.get-function("pow", $module: "math")
Invoke it
meta.call($fn, $arg1, $arg2)
Plain CSS fallback
meta.get-function("min", $css: true)
Safe optional path
@if meta.function-exists(…) { get-function … }
Hands-On
Examples Gallery
Each example resolves a function value, then uses it (usually via meta.call). Open View Compiled CSS for verified Dart Sass output.
📚 Getting Started
Simple resolve + call, and the official higher-order filter.
Example 1 — Basic get-function + call
Resolve a local function, store it, then invoke it.
Without $css: true, an unknown Sass min name would error (or collide with older global behavior). With the flag, Sass keeps a CSS min(…) in the output.
Applications
🚀 Real-World Use Cases
Higher-order helpers — filters, mappers, and reducers that accept a function value.
Configurable adjusters — choose grow/shrink (or theme helpers) from a flag.
Module bridging — resolve sass:math / other built-ins via $module.
Safe dynamic APIs — pair with meta.function-exists before resolving.
CSS function references — $css: true when you need plain CSS callables.
🧠 How Compilation Works
1
Resolve by name
Call meta.get-function("name") (optionally with $module / $css).
Source
2
Hold a function value
Store it in a variable or pass it into another function.
Value
3
Invoke with meta.call
Forward arguments and receive the return value.
Call
4
✓
CSS ships
Browsers never see get-function—only finished CSS.
Watch Out
⚠️ Common Pitfalls
Forgetting $module — math.pow will not resolve from a bare "pow".
Missing name without $css — throws at compile time.
Stopping at get-function — you still need meta.call to run it.
String call("name") — deprecated; resolve with get-function first.
Wrong namespace alias — $module must match this file’s @use … as name.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:meta" and meta.get-function()
Invoke results with meta.call
Pass $module for namespaced built-ins
Guard optional names with meta.function-exists
Prefer Dart Sass for modules
❌ Don’t
Pass string names to call() in new code
Assume bare names find sass:math members
Confuse this with meta.get-mixin
Expect the browser to resolve function values
Skip $css: true when you need a plain CSS callable
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about meta.get-function()
Resolve a function value by name, then run it with meta.call.
5
Core concepts
📝01
API
get-function($name)
Call
📦02
Module
sass:meta
@use
🔗03
Returns
function value
Result
⚙04
Options
$module / $css
Flags
✓05
Invoke
meta.call($fn, …)
Next
❓ Frequently Asked Questions
meta.get-function($name, $css: false, $module: null) returns a function value for the named function. You typically run that value with meta.call($fn, $args...).
When the function lives under a @use namespace. For example meta.get-function("pow", $module: "math") after @use "sass:math". The string must match that file’s namespace.
By default, a missing Sass function name throws. With $css: true, get-function returns a plain CSS function value instead—useful when you want to emit CSS like min() or clamp() as a function reference.
function-exists returns true/false. get-function returns the actual function value (or errors unless $css is true). Check with exists first for optional APIs.
Use meta.call($function, $args...). Passing a string name directly to call() is deprecated—get-function is the modern first step.
Yes. get-function($name, $css: false, $module: null) is the legacy global name. Prefer meta.get-function after @use "sass:meta".
Did you know?
Official Sass docs use the same remove-where sample for both meta.get-function and meta.call: resolve the condition once, pass the function value into the helper, and let meta.call run it on every list item.
meta.get-function() turns a function name into a reusable function value. Pass $module for @use namespaces, use $css: true for plain CSS callables, and always invoke the result with meta.call—the modern alternative to deprecated string call().