Skip to content

pantoken / packages/utils/src / danglingReferences

함수: danglingReferences()

danglingReferences(css): string[]

베타

자급성 검사: 스타일시트에서 var()를 통해 참조되었지만 해당 출력에서 절대 정의되지 않는 --instui-* 이름들(@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"]