Skip to content

pantoken / packages/utils/src / danglingReferences

Swyddogaeth: danglingReferences()

danglingReferences(css): string[]

Bêta

Gwiriad hunan-gynnwys: --instui-* enwau a grybwyllir drwy var() mewn dalen arddull nad yw byth yn ei diffinio (fel cofrestriad @property neu ddatganiad --x:). Wedi'i drefnu; mae'n wag yn golygu bod pob cyfeiriad yn datrys o fewn yr un allbwn. Defnyddiwch ar gyfer dalennau arddull hunangynhwysol (css, pendo).

Paramedrau

css

string

Y ddalen arddull a gynhyrchir.

Yn dychwelyd

string[]

Yr enwau cyfeiriadau ar goll.

Enghraifft

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"]