Skip to content

pantoken-root / formats/css/src / buildCssFile

دالة: buildCssFile() ​

buildCssFile(__namedParameters): string

Beta

بناء سلسلة ملف CSS: تسجيلات مُنَصَّفة @property (على المستوى الأعلى، غير مرتبطة بالثيم) تليها قسم واحد أو أكثر من التصريحات ذات النطاق (التي قد يعيد البناء المستهلك كتابة محدداتها).

Parameters ​

__namedParameters ​

comments ​

string[]

scope ​

string

properties? ​

PropertyRule[] = []

sections ​

CssSection[]

inherits? ​

boolean = true

Returns ​

string

Examples ​

سجّل خاصية مُنَصَّفة واحدة وأصدر تصريحًا ذا نطاق

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