Skip to content

pantoken / packages/utils/src / danglingReferences

Mahi: danglingReferences()

danglingReferences(css): string[]

Beta

Tirotiro mō te motuhake-whaiaro: ingoa --instui-* e tohu ana mā var() i roto i tētahi stylesheet kāore ia i tautuhia (hei rēhitatanga @property , hei whakapuakitanga --x:). Kua whakarārangi; mēnā he wāhi-kore, e tohu ana kua whakatau ngā tohu katoa i roto i taua putanga kotahi. Whakamahia mō ngā stylesheet motuhake (css, pendo).

Ngā Tawhā

css

string

Te stylesheet kua whakaputaina.

Whakahokia

string[]

Ngā ingoa tohutoro kāore e hono.

Tauira

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