Skip to content

pantoken / packages/utils/src / danglingReferences

פונקציה: danglingReferences()

danglingReferences(css): string[]

בטא

בדיקת עצמאות: שמות --instui-* המופנים דרך var() בגליון סגנונות שאינו מגדיר אותם אף פעם (כרישום @property או כהצהרת --x:). ממויין; מחרוזת ריקה משמעותה שכל ההתייחסויות נפתרות באותו פלט. יש להשתמש בכך עבור גלילי סגנון עצמאיים (css, pendo).

פרמטרים

css

string

גליון הסגנון שנוצר.

מחזיר

string[]

שמות ההתייחסויות התלויות.

דוגמה

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