Skip to content

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

Newidyn: mangleCustomProps

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

Bêta

Creu'r plugin PostCSS mangle-custom-properties.

Yn casglu pob enw eiddo wedi'i addasu sy'n cyfateb i prefix o briodweddau datganiad, cyfeiriadau var(), a pharametrau @property. Yn eu didoli yn nhrefn yr wyddor ar gyfer mapio sefydlog a phenderfynol, yna yn neilltuo enwau byr gan ddefnyddio'r method a ddewiswyd. Yn disodli pob digwyddiad ar draws y taflen arddull.

Type Declaration

Paramedrau

options?

MangleCustomPropsOptions

MangleCustomPropsOptions.

Yn dychwelyd

Plugin

Ategyn PostCSS Ategyn.

postcss

postcss: true

Marciwr ategyn PostCSS a benodir.

Enghreifftiau

Mangle gyda diofynion (--instui-\*, base26)

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

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

Rhannu'r mapio ar draws dau ffeil a llwythir gyda'i gilydd

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

Defnyddio enwau base36 a chyhoeddi'r mapio drwy 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");