Skip to content

pantoken / plugins/postcss/props-minify/src / mangleCustomProps

متغير: mangleCustomProps

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

بيتا

إنشاء مكوّن الإضافة mangle-custom-properties الخاص بـ PostCSS.

يجمع جميع أسماء الخصائص المخصصة المطابقة لـ prefix من خصائص التصريحات، ومرجعيات var(), ومعاملات @property. يقوم بفرزها أبجديًا للحصول على ترميز ثابت وحتمي ثم يعيّن أسماء قصيرة باستخدام method المختار. يستبدل كل حدوث لها في جميع أنحاء ورقة الأنماط.

Type Declaration

المعلمات

options?

MangleCustomPropsOptions

MangleCustomPropsOptions.

القيم المرجعة

Plugin

إضافة PostCSS Plugin.

postcss

postcss: true

علامة مكوّن PostCSS المطلوبة.

أمثلة

التشويش بالإعدادات الافتراضية (--instui-\*, base26)

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

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

مشاركة الخريطة عبر ملفين يتم تحميلهما معًا

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

استخدام أسماء base36 وإصدار الخريطة عبر 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");