Skip to content

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

Variabel: flattenProperty

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

Beta

Lag flatten-@property PostCSS-pluginen.

Går gjennom alle @property at-reglar i stilarket, trekker ut kvar initial-value‑beskrivelse, fjernar at-regelen og legg føre ei einskild injectSelector { --name: value; … }‑regel som inneheld alle utdragne deklarasjonar. Tomme reglar og @layer‑blokker som blir liggande att etter fjerning blir sletta.

Type Declaration

Parametrar

options?

FlattenPropertyOptions

FlattenPropertyOptions.

Returnerer

Plugin

Ein PostCSS plugin.

postcss

postcss: true

Nødvendig PostCSS-pluginmarkør.

Døme

Standard injeksjon i :root

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

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

Injiser i :scope (for bruk inne i scope-blokker)

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