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