Skip to content

pantoken / plugins/postcss/mangle-custom-props/src / mangleCustomProps

Spremenljivka: mangleCustomProps

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

Beta

Ustvari PostCSS vtičnik mangle-custom-properties.

Zbere vsa imena prilagojenih lastnosti, ki ustrezajo prefix iz lastnosti deklaracij, var() referenc, in parametrov @property. Razvrsti jih po abecedi za stabilno, deterministično preslikavo, nato priredi kratka imena z izbranim method. Zamenja vsako pojavljanje po celotnem stylesheetu.

Type Declaration

Parametri

options?

MangleCustomPropsOptions

MangleCustomPropsOptions.

Vrne

Plugin

PostCSS vtičnik.

postcss

postcss: true

Zahtevana oznaka PostCSS vtičnika.

Primeri

Uporabi privzete nastavitve (--instui-*, base26)

ts
import postcss from "postcss";
import { mangleCustomProps } from "@pantoken/plugin-mangle-custom-props";

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

Deli preslikavo med dvema datotekama, naloženima skupaj

ts
import postcss from "postcss";
import { mangleCustomProps } from "@pantoken/plugin-mangle-custom-props";

const manifest = new Map<string, string>();
const tokenCss = postcss([mangleCustomProps({ sharedManifest: manifest })]).process(tokens, { from: undefined }).css;
const componentCss = postcss([mangleCustomProps({ sharedManifest: manifest })]).process(components, { from: undefined }).css;
// both files use the same --instui-* → --a mapping

Uporabi base36 imena in izpiši preslikavo preko result.messages

ts
import postcss from "postcss";
import { mangleCustomProps } from "@pantoken/plugin-mangle-custom-props";

const result = postcss([mangleCustomProps({ method: "base36", propertyMap: true })]).process(css, { from: undefined });
const msg = result.messages.find((m) => m.type === "mangle-map");