Skip to content

pantoken / formats/css/src / buildCssFile

Fonksiyon: buildCssFile()

buildCssFile(__namedParameters): string

Beta

Bir CSS dosyası dizesi oluşturun: türü belirtilmiş @property kayıtları (üst düzey, tema-bağımsız) ve ardından tüketen derlemenin seçiciyi yeniden yazabileceği bir veya daha fazla kapsamlı bildirim bölümü.

Parametreler

__namedParameters

comments

string[]

scope

string

properties?

PropertyRule[] = []

sections

CssSection[]

inherits?

boolean = true

Döndürür

string

Örnekler

Bir türü belirtilmiş özellik kaydedin ve kapsamlı bir bildirim yayınlayın

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

Bir bölümü bir CSS cascade katmanına sarın

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

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