Skip to content

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

Variabile: flattenProperty

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

Beta

Crea il plugin PostCSS flatten-@property.

Scorre tutte le at-rule @property nel foglio di stile, estrae ogni descrittore initial-value, rimuove dell'at-rule e antepone una singola regola injectSelector { --name: value; … } contenente tutte le dichiarazioni estratte. Le regole vuote e i blocchi @layer lasciati dopo la rimozione vengono scartati.

Type Declaration

Parametri

options?

FlattenPropertyOptions

FlattenPropertyOptions.

Restituisce

Plugin

Un Plugin per PostCSS.

postcss

postcss: true

Marcatore obbligatorio del plugin PostCSS.

Esempi

Iniezione predefinita in :root

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

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

Iniettare in :scope (per l'uso all'interno dei blocchi 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