Skip to content

pantoken / packages/utils/src / danglingReferences

Fonksyon: danglingReferences()

danglingReferences(css): string[]

Beta

Chèk oto-konplèt: non --instui-* yo refere atravè var() nan yon stylesheet ke li pa janm defini (kòm yon enskripsyon @property oswa yon deklarasyon --x:). Triye; vid vle di chak referans rezoud andedan menm sòti a. Sèvi pou stylesheet oto-konplè (css, pendo).

Paramèt

css

string

Stylesheet ki jenere a.

Retounen

string[]

Non referans ki pandye yo.

Egzanp

ts
import { danglingReferences } from "@pantoken/utils";

// Self-contained: the referenced property is also defined here.
danglingReferences("@property --instui-a {} .b { color: var(--instui-a); }"); // → []

// Dangling: `--instui-b` is referenced but never defined.
danglingReferences(
  ":root { --instui-a: red; } .b { color: var(--instui-a); background: var(--instui-b); }",
); // → ["--instui-b"]