Skip to content

pantoken / formats/css/src / buildCssFile

함수: buildCssFile()

buildCssFile(__namedParameters): string

베타

CSS 파일 문자열을 생성합니다: 타입이 지정된 @property 등록(최상위, 테마 무관)을 먼저 추가한 다음 하나 이상의 스코프된 선언 섹션(소비하는 빌드가 선택자를 재작성할 수 있음)을 이어서 추가합니다.

매개변수

__namedParameters

comments

string[]

scope

string

properties?

PropertyRule[] = []

sections

CssSection[]

inherits?

boolean = true

반환값

string

예제들

하나의 타입 지정 프로퍼티를 등록하고 스코프된 선언을 내보냅니다

ts
import { buildCssFile } from "@pantoken/css";

buildCssFile({
  comments: ["/* my tokens */"],
  scope: ":root",
  properties: [{ name: "--instui-color-brand", syntax: "<color>", value: "#0374b5" }],
  sections: [{ pairs: [["--instui-color-text-base", "var(--instui-color-brand)"]] }],
});

섹션을 CSS 캐스케이드 레이어로 래핑합니다

ts
import { buildCssFile } from "@pantoken/css";

buildCssFile({
  comments: [],
  scope: ":root",
  sections: [{ layer: "pantoken", pairs: [["--instui-spacing-space-md", "1rem"]] }],
});