Skip to content

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

Athróg: mangleCustomProps

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

Béite

Cruthaigh an breiseán PostCSS mangle-custom-properties.

Bhailíonn sé gach ainm airíonna saincheaptha a thagann le prefix ó airíonna ráite, tagairtí var(), agus paraiméadair @property. Sórtálann sé iad de réir aibítre le haghaidh léarscáil chobhsaí, chinneadhchomhfhreagrach, ansin cuireann sé ainmneacha giorra orthu ag úsáid an method roghnaithe. Cuireann sé in áit gach tarlú ar fud an stíleálaillín.

Type Declaration

Paraiméadair

options?

MangleCustomPropsOptions

MangleCustomPropsOptions.

Tuairisceáin

Plugin

Breiseán PostCSS Plugin.

postcss

postcss: true

Marcóir riachtanach do bhreiseán PostCSS.

Samplaí

Mangle le réamhshocruithe (--instui-\*, base26)

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

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

Roinn an léarscáil trasna dhá chomhad a luchtítear le chéile

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áid ainmneacha base36 agus seol an léarscáil trí 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");