Sass meta.inspect()

Beginner
7 min read
Updated: Nov 2026
5 examples
Dart Sass

Definition and Usage

meta.inspect($value) returns an unquoted string representation of any Sass value—not just values that can appear in CSS. Load it with @use "sass:meta".

Official samples.

meta.inspect(10px 20px 30px) → 10px 20px 30px · map ("width": 200px) · null · quoted "Helvetica".

Debugging only.

Official heads-up: the format is not guaranteed across Sass versions or implementations. Do not depend on the exact string in production CSS.

Prefer @debug in real projects.

Official docs use @debug meta.inspect(…), which prints to the compiler. These examples put the string in a custom property so you can open View Compiled CSS.

Syntax

SCSS
@use "sass:meta";

meta.inspect($value); //=> unquoted string

@debug meta.inspect(10px 20px 30px);       // 10px 20px 30px
@debug meta.inspect(("width": 200px));     // ("width": 200px)
@debug meta.inspect(null);                 // null
@debug meta.inspect("Helvetica");          // "Helvetica"

// Global alias (legacy): inspect($value)
// Prefer meta.inspect after @use "sass:meta"

Pattern: pass any value → get a readable string → print with @debug (or temporary CSS while learning) → remove before shipping.

What Inspect Shows

Common value shapes and typical inspect text:

ValueTypical inspect textNotes
List 10px 20px 30px10px 20px 30pxSpace-separated as written
Map ("width": 200px)("width": 200px)Maps are Sass-only
nullnullNo CSS form of its own
Quoted string"Helvetica"Quotes stay visible
Number / boolean42 / trueSimple snapshots
vs meta.type-of.

meta.type-of answers “what kind?” (map, string, …). inspect answers “what does it look like?”

SCSS Examples

Examples use @use "sass:meta" and put inspect text into custom properties so you can open View Compiled CSS (matches official Sass docs samples where shown). Prefer @debug in day-to-day work.

Example 1 — Inspect a List

Space-separated lengths become a readable string.

SCSS
@use "sass:meta";

// @debug meta.inspect(10px 20px 30px);
:root {
  --list: #{meta.inspect(10px 20px 30px)};
}

How It Works

  1. Pass a list of lengths.
  2. inspect returns an unquoted string.
  3. Interpolation places that text in CSS.
  4. Matches the official docs list sample.

Example 2 — Inspect a Map

Maps are Sass-only; inspect shows their structure as text.

SCSS
@use "sass:meta";

// @debug meta.inspect(("width": 200px));
:root {
  --map: #{meta.inspect(("width": 200px))};
}

How It Works

  1. Sass maps cannot go straight into CSS.
  2. inspect builds a string snapshot.
  3. You see keys and values for debugging.
  4. Matches the official docs map sample.

Example 3 — Inspect null

null has no CSS form; inspect still describes it.

SCSS
@use "sass:meta";

// @debug meta.inspect(null);
:root {
  --null: #{meta.inspect(null)};
}

How It Works

  1. null is a Sass value, not a CSS keyword here.
  2. inspect yields the text null.
  3. Useful when a variable unexpectedly emptied.
  4. Matches the official docs null sample.

Example 4 — Inspect a Quoted String

Quoted Sass strings keep their quotes visible in the inspect output.

SCSS
@use "sass:meta";

// @debug meta.inspect("Helvetica");
:root {
  --font: #{meta.inspect("Helvetica")};
}

How It Works

  1. Quoted string is passed to inspect.
  2. Output keeps the surrounding quotes.
  3. Helps when quote style matters for later string helpers.
  4. Matches the official docs string sample.

Example 5 — Mixed Debug Panel

Inspect several types side by side while learning Sass values.

SCSS
@use "sass:meta";

$tokens: (
  "gap": 1rem,
  "ok": true
);

:root {
  --number: #{meta.inspect(42)};
  --bool: #{meta.inspect(true)};
  --tokens: #{meta.inspect($tokens)};
}

How It Works

  1. Numbers and booleans stringify simply.
  2. The map shows keys and values together.
  3. Treat as a learning aid, then delete it.
  4. Production CSS should use real values, not inspect text.

Edge Cases & Pitfalls

Most inspect bugs are treating debug text as stable production CSS.

format

Output is not stable

Official docs: do not rely on the exact string across Sass versions.

css

Not always valid CSS

Maps, null, and other Sass-only values may produce non-CSS text.

ship

Remove before production

Prefer @debug while coding; delete temporary custom properties.

vs

Need the type name?

Use meta.type-of instead of parsing inspect text.

Sass Support

Prefer the module form with current Dart Sass.

APIStatus
meta.inspect()Dart Sass via @use "sass:meta"
Return typeUnquoted string
Intended useDebugging / learning
Legacy globalinspect($value)

Compile with the Dart Sass CLI.

Key Takeaways

  • Stringifies any Sass value for humans reading the compiler.
  • Not guaranteed CSS and not a stable public format.
  • Prefer @debug meta.inspect(…) while developing.
  • Use type-of for kinds; use inspect for value snapshots.

One line: when you need a readable snapshot of any Sass value, use meta.inspect($value).

Compile Notes

Practical checklist:

checklist.txt
1. @use "sass:meta"
2. @debug meta.inspect($value)
3. Or temporary: --peek: #{meta.inspect($value)}
4. Do not ship inspect-dependent CSS
5. Prefer type-of when you only need the kind

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.
type-of returns the type name (number, string, map, …). inspect returns a full string snapshot of the value itself.
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.

Next: Sass meta.keywords()

Read keyword arguments from an argument list.

meta.keywords() →

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.

8 people found this page helpful