Skip to content

pantoken / plugins/postcss/flatten-property/src / flattenProperty

משתנה: flattenProperty

const flattenProperty: {(options?): Plugin; postcss: true; }

בטא

צור את תוסף PostCSS flatten-@property.

עובר על כל @property at-rules בגליון הסגנון, מוציא כל מתאר initial-value, מסיר את ה-at-rule, ומוסיף בתחילתו כלל injectSelector { --name: value; … } יחיד המכיל את כל ההכרזות שהוצאו. כללים ריקים וחסימות @layer שנשארו לאחר ההסרה יושמטו.

Type Declaration

פרמטרים

options?

FlattenPropertyOptions

FlattenPropertyOptions.

מחזיר

Plugin

תוסף של PostCSS תוסף.

postcss

postcss: true

סמן דרוש לתוסף PostCSS.

דוגמאות

הזרקה ברירת מחדל ל-:root

ts
import postcss from "postcss";
import { flattenProperty } from "@pantoken/plugin-flatten-property";

const out = postcss([flattenProperty()]).process(css, { from: undefined }).css;

הזרקה ל-:scope (לשימוש בתוך בלוקי scope)

ts
import postcss from "postcss";
import { flattenProperty } from "@pantoken/plugin-flatten-property";

const out = postcss([flattenProperty({ injectSelector: ":scope" })]).process(css, { from: undefined }).css;
ts
Preserve