Skip to content

pantoken / formats/css/src / buildCssFile

ฟังก์ชัน: buildCssFile()

buildCssFile(__namedParameters): string

เบต้า

สร้างสตริงไฟล์ CSS: การลงทะเบียนแบบ typed @property (ระดับบนสุด ไม่ขึ้นกับธีม) ตามด้วย หนึ่งหรือมากกว่าหนึ่งส่วนของประกาศแบบมีขอบเขต (ซึ่งตัวเลือกของมันอาจถูกปรับโดยการ build ที่ใช้งาน).

พารามิเตอร์

__namedParameters

comments

string[]

scope

string

properties?

PropertyRule[] = []

sections

CssSection[]

inherits?

boolean = true

คืนค่า

string

ตัวอย่าง

ลงทะเบียนคุณสมบัติแบบ typed หนึ่งรายการ และสร้างประกาศแบบมีขอบเขต

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)"]] }],
});

ห่อส่วนในเลเยอร์ cascade ของ CSS

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

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