Skip to content

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

Varyab: mangleCustomProps

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

Beta

Kreye plugin PostCSS mangle-custom-properties la.

Rasanble tout non pwopriyete personnalizé ki matche ak prefix soti nan deklarasyon props, var() referans, ek param @property. Triye yo alfabetikman pou yon mapaj ki estab ak detèministik, epi aisyen non kout lè l sèvi avèk method chwazi a. Ranplase chak aparisyon atravè tout fichye estil la.

Type Declaration

Paramèt

options?

MangleCustomPropsOptions

MangleCustomPropsOptions.

Retounen

Plugin

Yon PostCSS Plugin.

postcss

postcss: true

Makè plugin PostCSS ki obligatwa.

Egzanp

Mangle ak valè pa defo (--instui-\*, base26)

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

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

Pataje mapaj la atravè de fichye ki chaje ansanm

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

Sèvi ak non base36 epi emèt mapaj la atravè 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");