meta.mixin-exists() belongs to the built-in sass:meta module. It answers a simple question: is there a mixin named X? This page covers $module with @use, optional include patterns, safer alternatives to deprecated meta.feature-exists, and five compiled examples.
01
Concept
Is this mixin defined?
02
Module
@use "sass:meta"
03
Returns
true / false
04
$module
Check a @use namespace
05
vs others
function / get-mixin
06
Practice
5 examples
Concept
What Is meta.mixin-exists()?
Official docs: returns whether a mixin named $name exists. Use it when a library or theme wants an optional @mixin without crashing if that mixin is missing.
Without $module, Sass looks for a mixin without a namespace in the current file.
With $module, it looks inside a @use namespace from the current file.
Missing names return false—they do not throw.
💡
Beginner tip
Think of a toolbox: mixin-exists asks “do we have a hammer named shadow-none?” It does not swing the hammer—that is @include, or meta.get-mixin + meta.apply.
Foundation
📝 Syntax
styles.scss
@use "sass:meta";
// Recommended
meta.mixin-exists($name, $module: null)
// Legacy global name (no $module argument)
mixin-exists($name)
Parameters
Parameter
Type
Required
Description
$name
String
Yes
Mixin name to look up (without parentheses or @mixin).
$module
String or null
No
If set, must match a @use namespace in the current file. Checks that module for $name.
Return value
Type
Result
Boolean
true if the mixin exists; otherwise false
Modules
📦 Loading sass:meta
styles.scss
// Recommended — namespaced
@use "sass:meta";
@use "utils";
$ok: meta.mixin-exists("center", $module: "utils");
// Optional — bring members into scope
@use "sass:meta" as *;
$ok: mixin-exists("shadow-none");
// Legacy global
$ok: mixin-exists("shadow-none");
Details
🔗 Using the $module Argument
After @use "utils", mixins from that file live under the utils namespace. Check them with a module name:
styles.scss
@use "sass:meta";
@use "utils";
// Official style (positional $module)
@debug meta.mixin-exists("center", "utils"); // true
// Equivalent named argument
@debug meta.mixin-exists("center", $module: "utils"); // true
// Without $module, "center" is not defined in this file
@debug meta.mixin-exists("center"); // false
$module must match the namespace used in the current file. If you write @use "utils" as u, pass $module: "u".
Compare
📋 Related Meta Helpers
Helper
Checks
Returns
meta.mixin-exists
Mixins
Boolean
meta.function-exists
Functions
Boolean
meta.global-variable-exists
Global variables
Boolean
meta.get-mixin
Mixins
Mixin value (for meta.apply)
meta.feature-exists
Legacy feature flags
Boolean — deprecated
Support
🛠 Compatibility
This is about Sass compilers, not browsers. The lookup runs at compile time.
Implementation
mixin-exists
Dart Sass
Yes — prefer meta.mixin-exists with $module
LibSass
Yes (legacy global / limited modules)
Ruby Sass
Yes (legacy global / limited modules)
Prefer current Dart Sass so @use namespaces work as shown in the docs.
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import meta
@use "sass:meta";
Local / current file
meta.mixin-exists("shadow-none")
Inside a module
meta.mixin-exists("center", $module: "utils")
Optional include path
@if meta.mixin-exists(…) { @include … }
Get the mixin value
meta.get-mixin("shadow-none")
Check a function instead
meta.function-exists("name")
Hands-On
Examples Gallery
Each example uses meta.mixin-exists at compile time. Open View Compiled CSS for verified Dart Sass output.
📚 Getting Started
Official-style lookups for custom and module mixins.
Example 1 — Custom Mixin Before and After
A name is missing until you define it in the same stylesheet (official shadow-none idea).
Looks in the current file or the named @use module.
Compile
3
Boolean drives @if
Your stylesheet keeps or skips optional mixin includes.
Branch
4
✓
CSS ships
Browsers never see meta.mixin-exists—only finished rules.
Watch Out
⚠️ Common Pitfalls
Forgetting $module — a mixin from @use "utils" will not match a bare "center" check.
Wrong namespace string — must match the @use … as name in this file.
Confusing with get-mixin — exists returns a boolean; get-mixin returns a value.
Checking functions — use meta.function-exists instead.
Expecting runtime checks — everything resolves when Sass compiles.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:meta" and meta.mixin-exists()
Pass $module for namespaced mixins
Prefer this over deprecated feature-exists
Guard dynamic meta.apply paths
Prefer Dart Sass for module namespaces
❌ Don’t
Assume bare names find mixins from other @use files
Call get-mixin on unchecked names in optional APIs
Use it to detect functions or CSS browser support
Expect the browser to evaluate the check
Rely on typo-prone string names without tests
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about meta.mixin-exists()
Ask whether a mixin is defined—optionally inside a @use module.
5
Core concepts
📝01
API
mixin-exists($name)
Call
📦02
Module
sass:meta
@use
✅03
Returns
boolean
Result
🔗04
$module
@use namespace
Scope
✓05
Next step
get-mixin + apply
Tooling
❓ Frequently Asked Questions
meta.mixin-exists($name, $module: null) returns true if a mixin named $name is defined, otherwise false.
When the mixin lives in a @use namespace. $module must match that namespace string—for example meta.mixin-exists("center", $module: "utils") after @use "utils".
mixin-exists only answers yes/no. get-mixin returns the mixin value so you can include it with meta.apply. Use exists first for optional mixin names.
mixin-exists looks for mixins. function-exists looks for functions. Same idea, different member type.
Yes for detecting mixins. Official docs recommend function-exists, mixin-exists, and global-variable-exists instead of the deprecated feature-exists helper.
Yes. mixin-exists($name) is the legacy global form (no $module). Prefer meta.mixin-exists after @use "sass:meta".
Did you know?
Official Sass migration guidance for deprecated meta.feature-exists points authors toward meta.function-exists, meta.mixin-exists, and meta.global-variable-exists—member checks that stay useful as new APIs ship.
meta.mixin-exists() returns whether a named mixin is defined. Pass $module for @use namespaces, use it to guard optional includes, and pair it with meta.get-mixin / meta.apply when you need to include the mixin dynamically.