Skip to content

pantoken / packages/utils/src / danglingReferences

Függvény: danglingReferences()

danglingReferences(css): string[]

Béta

Önelégségességi ellenőrzés: --instui-* nevek hivatkozva var() útvonalon egy stíluslapon, amelyet soha not határoz meg (mint @property regisztráció vagy --x: deklaráció). Rendezve; üres azt jelenti, hogy minden hivatkozás ugyanazon a kimeneten belül oldódik meg. Önelégséges stíluslapokhoz használja (css, pendo).

Paraméterek

css

string

A generált stíluszlap.

Visszatérés

string[]

A lógó referencia nevek.

Példa

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