Skip to content

pantoken / props-minify

props-minify

Beta

@pantoken/plugin-props-minify — konpoze transfòmasyon prune, flatten, ak mangle pou --instui-* pwopriyete koutim atravè yon sèl itilite applyMinify.

Chak pipeline ki pwodwi CSS (generate scripts, renderers) itilize applyMinify pou yon sifas minifikasyon ki konsistan san yo pa pran yon depandans PostCSS dirèk.

Prune + mangle yo sèlman san danje pou pake ki izole tèt yo kote tout referans var(--instui-*) ak definisyon yo rete nan menm rezilta a. Pou konsomatè ki sèvi ak fichye separe (@pantoken/css + @pantoken/components chaje endepandamman), aplike sèlman { flatten: true }.

Mangle atravè limit fichye: pase menm enstans Map la kòm mangle.sharedManifest bay chak apèl applyMinify ki trete fichye CSS yo ansanm. Tretman fèy token an an premye (li ranpli manifest la), epi apre sa fèy konpozan yo.

Egzanp

Aplike twa transfòmasyon yo tout sou yon pake ki izole tèt li

ts
import { applyMinify } from "@pantoken/plugin-props-minify";
const out = applyMinify(css, { prune: true, flatten: true, mangle: true });

Sèlman flatten (san danje pou konsomatè ki itilize fichye separe)

ts
import { applyMinify } from "@pantoken/plugin-props-minify";
const out = applyMinify(css, { flatten: true });

Mangle de fichye ak menm map la

ts
import { applyMinify } from "@pantoken/plugin-props-minify";
const manifest = new Map<string, string>();
const tokenCss = applyMinify(rawTokens, { mangle: { sharedManifest: manifest } });
const componentCss = applyMinify(rawComponents, { mangle: { sharedManifest: manifest } });

Entèfas

Alyas tip

Varyab

Fonksyon