Skip to content

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

Taipūtī: mangleCustomProps

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

Beta

Hangaia te mono PostCSS mangle-custom-properties.

Ka kohi i ngā ingoa rawa ritenga katoa e hāngai ana ki prefix mai i ngā prop whakapuaki, ngā tohutoro var(), me ngā pārameta @property. Ka raupapa rātou kia ā-tika, kia pumau ai te mapi, katahi ka tohua ngā ingoa poto mā te whakamahi i te method. Ka whakakapi i ia tukunga puta noa i te raupapa-kāhua.

Type Declaration

Ngā Tawhā

options?

MangleCustomPropsOptions

MangleCustomPropsOptions.

Whakahokia

Plugin

He PostCSS Plugin.

postcss

postcss: true

Tohu mono PostCSS e hiahiatia ana.

Ngā tauira

Whakamāngia me ngā tautuhinga taunoa (--instui-\*, base26)

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

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

Tūhonohia te mapi ki ngā kōnae e rua ka utaina tahi

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

Whakamahia ngā ingoa base36, ka whakaputa i te mapi mā 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");