Sass meta.feature-exists()

Intermediate
8 min read
Updated: Nov 2026
5 examples
Deprecated

Definition and Usage

meta.feature-exists($feature) returns a boolean: whether the current Sass implementation reports support for the named $feature string. Unrecognized names return false. Load it with @use "sass:meta".

Official samples.

meta.feature-exists("at-error") → true · meta.feature-exists("unrecognized") → false.

Deprecated — avoid in new code.

Official docs say this helper is deprecated and should be avoided. Dart Sass emits deprecation warnings on every call. Prefer deleting checks; modern Dart Sass already covers the capabilities this function gated.

Safer replacements.

For member detection, use meta.function-exists, meta.mixin-exists, or meta.global-variable-exists.

Syntax

SCSS
@use "sass:meta";

meta.feature-exists($feature); //=> boolean  (deprecated)

meta.feature-exists("at-error");      // true
meta.feature-exists("unrecognized");  // false

// Global alias (legacy): feature-exists($feature)
// Prefer removing both forms in new projects

Pattern for legacy code: read the feature string → understand the boolean → plan removal rather than adding new branches.

Recognized Features

Official docs list these feature strings:

Feature stringMeaning
global-variable-shadowingLocal variables shadow globals unless marked !global
extend-selector-pseudoclass@extend affects selectors nested in pseudo-classes like :not()
units-level3Unit arithmetic supports CSS Values and Units Level 3 units
at-errorThe @error rule is supported
custom-propertyCustom property values only allow interpolation (not full Sass expressions)
Any other stringReturns false
Compiler-reported, not a guarantee.

A true/false answer is what that implementation reports for the string. Prefer deleting the check on modern Dart Sass instead of trusting long-term.

SCSS Examples

Examples show the legacy API for reading older code. Expect deprecation warnings from Dart Sass. Open View Compiled CSS for verified output.

Example 1 — Official Docs Sample (at-error)

Modern Dart Sass reports support for @error.

SCSS
@use "sass:meta";

@debug meta.feature-exists("at-error"); // true

.basic {
  --at-error: #{meta.feature-exists("at-error")};
}

How It Works

  1. Feature string is "at-error".
  2. Dart Sass reports true.
  3. Deprecation warning still prints at compile time.
  4. Matches the official Sass docs sample.

Example 2 — Official Docs Sample (Unrecognized)

Unknown feature names return false.

SCSS
@use "sass:meta";

@debug meta.feature-exists("unrecognized"); // false

.unknown {
  --ok: #{meta.feature-exists("unrecognized")};
}

How It Works

  1. String is not in the recognized list.
  2. Return value is false.
  3. No new features are being added to this API.
  4. Matches the official Sass docs sample.

Example 3 — Survey Recognized Names

What current Dart Sass reports for the classic feature strings.

SCSS
@use "sass:meta";

.list {
  --gvs: #{meta.feature-exists("global-variable-shadowing")};
  --extend: #{meta.feature-exists("extend-selector-pseudoclass")};
  --units: #{meta.feature-exists("units-level3")};
  --error: #{meta.feature-exists("at-error")};
  --custom: #{meta.feature-exists("custom-property")};
}

How It Works

  1. Most classic names report true here.
  2. units-level3 may report false even on modern Dart Sass.
  3. Do not build production gates on these results.
  4. Prefer removing the helper entirely.

Example 4 — Legacy Conditional (Avoid in New Code)

Old libraries sometimes branched on feature support. Prefer deleting the branch.

SCSS
@use "sass:meta";

.legacy {
  @if meta.feature-exists("at-error") {
    --can-error: true;
  } @else {
    --can-error: false;
  }
}

How It Works

  1. Branch compiles to a fixed custom property.
  2. On modern Dart Sass, the true path always wins for at-error.
  3. Deprecation still warns.
  4. Better: assume @error exists and drop the check.

Example 5 — Migrate to Member Checks

Replace feature probes with targeted meta helpers when you need detection.

SCSS
@use "sass:meta";
@use "sass:math";

// Instead of meta.feature-exists("…"):
.migrate {
  --has-div: #{meta.function-exists("div", $module: "math")};
  --has-abs: #{meta.function-exists("abs", $module: "math")};
}

How It Works

  1. Ask about a member, not a vague feature string.
  2. function-exists is the supported approach.
  3. No feature-exists deprecation warning here.
  4. Often you can delete the check and call the API directly.

Edge Cases & Pitfalls

Most feature-exists bugs are treating a deprecated probe as a long-term public API.

deprecated

Do not add new calls

Official docs say avoid it. New projects should never introduce feature-exists.

false

Recognized ≠ always true

A listed name can still report false on some compilers (for example units-level3 on current Dart Sass).

unknown

Unknown strings are false

There is no registry of new feature names. Custom strings always fail the check.

migrate

Prefer member helpers

Use function-exists / mixin-exists / global-variable-exists, or delete the gate.

Sass Support

Still callable today, but deprecated on modern Dart Sass.

APIStatus
meta.feature-exists()Deprecated; emits warnings in current Dart Sass
Global feature-exists()Legacy; same deprecation
Dart Sass 2.0Expected to throw / treat global name as CSS
ArgumentString feature name

Compile with the Dart Sass CLI.

Key Takeaways

  • Legacy boolean probe for named compiler features.
  • Deprecated — avoid in new SCSS.
  • Unknown strings → false; prefer deleting checks.
  • Migrate to member helpers when you need detection.

One line: when you see meta.feature-exists($feature) in old code, plan to remove it rather than extend it.

Compile Notes

Practical checklist:

checklist.txt
1. Recognize feature-exists as deprecated
2. Expect Dart Sass deprecation warnings
3. Prefer deleting the check on modern Dart Sass
4. Use function-exists / mixin-exists / global-variable-exists instead
5. Do not invent new feature strings

Frequently Asked Questions

meta.feature-exists($feature) returns true if the current Sass compiler claims support for a named legacy feature string, or false for unrecognized names. It is deprecated and should not be used in new code.
Official Sass docs say this function is deprecated and should be avoided. No new feature strings were added for a long time, and modern Dart Sass already supports the capabilities these checks were meant to gate—so most calls can simply be removed.
Dart Sass emits deprecation warnings today. In Dart Sass 2.0.0, meta.feature-exists() is expected to throw, and the global feature-exists() name may be treated as a plain CSS function call.
Usually nothing—delete the check. For specific members, use meta.function-exists, meta.mixin-exists, or meta.global-variable-exists.
global-variable-shadowing, extend-selector-pseudoclass, units-level3, at-error, and custom-property. Any other string returns false.
Yes. feature-exists($feature) is the legacy global name. Prefer meta.feature-exists only while reading old code—and plan to remove both forms.

Next: Sass meta.function-exists()

Use the supported way to check whether a function name is defined.

meta.function-exists() →

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