Skip to content

pantoken / formats/css/src / buildCssFile

Swyddogaeth: buildCssFile()

buildCssFile(__namedParameters): string

Bêta

Adeiladu llinyn ffeil CSS: cofrestriadau mathus @property (prif lefel, annibynnol ar themâu) yn dilyn un neu ragor o adrannau datganiad wedi'u cwmpasu (y gall adeilad sy'n eu defnyddio ailysgrifennu ei ddewiswr).

Paramedrau

__namedParameters

comments

string[]

scope

string

properties?

PropertyRule[] = []

sections

CssSection[]

inherits?

boolean = true

Yn dychwelyd

string

Enghreifftiau

Cofrestru un eiddo wedi'i deipio a chynhyrchu datganiad wedi'i gwmpasu

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

Amgáu adran mewn haen cascâd CSS

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

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