meta.inspect() belongs to the built-in sass:meta module. It turns any Sass value into an unquoted string so you can see what the compiler is holding. This page covers lists, maps, null, strings, why the format is for debugging only, and five compiled examples.
01
Concept
Value → debug string
02
Module
@use "sass:meta"
03
Returns
Unquoted string
04
Purpose
Debugging
05
Caution
Format not stable
06
Practice
5 examples
Concept
What Is meta.inspect()?
Official docs: returns a string representation of $value. It works for any Sass value—not only things that can appear in CSS. That makes it perfect for @debug and temporary inspection, and a poor choice for permanent production CSS.
💡
Beginner tip
Think of inspect as a flashlight for your Sass values. Use it to look around, not as a permanent light fixture in your stylesheet.
⚠️
Official heads-up
Intended for debugging. The output format is not guaranteed to stay the same across Sass versions or implementations. Do not depend on the exact string in shipped CSS.
Foundation
📝 Syntax
styles.scss
@use "sass:meta";
// Recommended
meta.inspect($value)
// Legacy global name
inspect($value)
Parameters
Parameter
Type
Required
Description
$value
Any
Yes
Any Sass value: number, color, list, map, string, boolean, null, and more.
Return value
Type
Result
Unquoted string
A human-readable representation of $value (not guaranteed CSS-safe)
Modules
📦 Loading sass:meta
styles.scss
// Recommended — namespaced
@use "sass:meta";
@debug meta.inspect((a: 1, b: 2));
// Optional — bring members into scope
@use "sass:meta" as *;
@debug inspect(null);
// Legacy global
@debug inspect("Helvetica");
Details
🔎 @debug vs Emitting CSS
Official samples use @debug meta.inspect(…), which prints to the compiler console and does not appear in CSS. For tutorials and DevTools peeks, you can also interpolate into a custom property temporarily:
styles.scss
@use "sass:meta";
// Console only (best for day-to-day debugging)
@debug meta.inspect(("width": 200px));
// Temporary CSS token (remove before shipping)
:root {
--peek: #{meta.inspect(("width": 200px))};
}
Support
🛠 Compatibility
This is about Sass compilers, not browsers. Inspection happens at compile time.
Implementation
inspect
Dart Sass
Yes — prefer meta.inspect
LibSass
Yes (legacy global / pipelines)
Ruby Sass
Yes (legacy global / pipelines)
Prefer current Dart Sass, and treat the string format as a debug convenience.
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import meta
@use "sass:meta";
Inspect a value
meta.inspect($value)
Print to console
@debug meta.inspect($value);
Peek in CSS (temporary)
--peek: #{meta.inspect($value)};
Avoid
Depending on the exact string in production CSS
Hands-On
Examples Gallery
Examples interpolate meta.inspect into custom properties so you can open View Compiled CSS. In real projects, prefer @debug and remove these tokens before shipping.
📚 Getting Started
Official-style samples for lists, maps, null, and strings.
Example 1 — Inspect a List
Space-separated lengths become a readable string.
styles.scss
@use "sass:meta";
// @debug meta.inspect(10px 20px 30px);
:root {
--list: #{meta.inspect(10px 20px 30px)};
}
📤 Compiled CSS:
:root {
--list: 10px 20px 30px;
}
How It Works
Official docs describe this as an unquoted string like 10px 20px 30px—handy when a list is hard to visualize mid-compile.
Example 2 — Inspect a Map
Maps are Sass-only; inspect shows their structure as text.
Numbers and booleans stringify simply; the map shows keys and values together. Treat this panel as a learning aid, then delete it.
Applications
🚀 Real-World Use Cases
@debug while coding — print maps/lists that do not fit in CSS.
Teaching Sass types — show beginners what a value “looks like” to the compiler.
Temporary DevTools peeks — custom properties during local development only.
Library diagnostics — help consumers understand unexpected config shapes.
Not for design tokens in production — prefer real CSS values and maps APIs.
🧠 How Compilation Works
1
Pass any Sass value
Call meta.inspect($value) with a list, map, null, string, …
Source
2
Sass builds a string
You get an unquoted string description of that value.
Compile
3
Print or peek
Use @debug (best) or temporary interpolation while learning.
Debug
4
✓
Remove before shipping
Do not rely on the exact inspect string in production CSS.
Watch Out
⚠️ Common Pitfalls
Treating output as stable API — format can change between Sass versions.
Assuming valid CSS — maps and null strings are not design tokens.
Leaving peeks in production — strip debug custom properties before release.
Using inspect instead of map/list APIs — read values with map.get, not string parsing.
Expecting runtime inspection — browsers never evaluate meta.inspect.
Pro Tips
💡 Best Practices
✅ Do
Use @use "sass:meta" and meta.inspect()
Prefer @debug meta.inspect(…) while coding
Inspect maps/lists that confuse you
Remove temporary CSS peeks before shipping
Treat the string as human-readable only
❌ Don’t
Parse inspect output to drive production styles
Depend on exact punctuation across Sass upgrades
Ship --debug tokens to users
Confuse it with CSS attr() or browser DevTools
Expect every result to be valid CSS
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about meta.inspect()
Stringify any Sass value for debugging—not for stable production CSS.
5
Core concepts
📝01
API
inspect($value)
Call
📦02
Module
sass:meta
@use
📄03
Returns
unquoted string
Result
🔎04
Purpose
debugging
Use
✓05
Caution
format unstable
Safe
❓ Frequently Asked Questions
meta.inspect($value) returns an unquoted string representation of any Sass value—lists, maps, null, strings, numbers, and more—so you can see what Sass holds during compilation.
Not always. Official docs: inspect can represent values that cannot appear in CSS, so the string is not guaranteed to be valid CSS. Prefer it for @debug or temporary custom properties while learning.
No. Official heads-up: inspect is for debugging and its format is not guaranteed to stay the same across Sass versions or implementations. Do not build production CSS that depends on the exact string.
Simple interpolation or quoting may fail or look different for maps, null, and other Sass-only types. inspect is designed to stringify any Sass value for humans.
Yes. inspect($value) is the legacy global name. Prefer meta.inspect after @use "sass:meta".
Usually no. Use it while debugging with @debug or temporary tokens, then remove it from production CSS.
Did you know?
Official Sass docs show meta.inspect on a list, a map, null, and a quoted string in one block—exactly the cases where plain CSS cannot show you what Sass is thinking.
meta.inspect() returns an unquoted string describing any Sass value. Use it with @debug (or temporary peeks) while learning and troubleshooting—and remember the official warning: the format is for debugging, not a stable CSS contract.