Skip to content

pantoken / packages/utils/src / danglingReferences

Fonksiyon: danglingReferences()

danglingReferences(css): string[]

Beta

Kendi içinde tamlık kontrolü: --instui-* adları, bir stil sayfasında var() aracılığıyla referans verilir ancak o stil sayfası bunları asla tanımlamaz (bir @property kaydı veya bir --x: bildirimi olarak). Sıralanmıştır; boş olması, her referansın aynı çıktı içinde çözüldüğü anlamına gelir. Kendine yeten stil sayfaları (css, pendo) için kullanın.

Parametreler

css

string

Oluşturulan stil sayfası.

Döndürür

string[]

Asılı kalan referans adları.

Örnek

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