Skip to content

pantoken-root / plugins/postcss/mangle-custom-props/src / MangleCustomPropsOptions

介面: MangleCustomPropsOptions ​

Beta(測試)

關於 mangleCustomProps 的選項。

屬性 ​

prefix? ​

optional prefix?: string

Beta(測試)

只有以此字串開頭的自訂屬性名稱會被混淆。

預設值 ​

"--instui-"


method? ​

optional method?: MangleMethod

Beta(測試)

用來產生短替代名稱的演算法。

  • "base26" — --a, --b, …, --z, --aa, --ab, …(預設;對大量集合最短)
  • "base36" — --0, --1, …, --9, --a, …, --z, --10, …(字母數字)
  • "numeric" — --0, --1, --2, …

預設值 ​

"base26"


propertyMap? ​

optional propertyMap?: boolean

Beta(測試)

當 true 時,處理後會在 PostCSS 的 result.messages 中附加一個 mangle-map 條目。 該訊息的形狀為 { type: "mangle-map", plugin: "pantoken-mangle-custom-props", map: Map<string, string> }。

預設值 ​

false


sharedManifest? ​

optional sharedManifest?: Map<string, string>

Beta(測試)

可變的 Map,在多個 PostCSS 過程中共享。

每一次處理過程,外掛會讀取既有條目(重複使用它們的短名稱)並寫入新的條目 (從 sharedManifest.size 繼續計數)。將相同的 Map 實例傳給 每個處理會一起在瀏覽器中載入的 CSS 檔案的 mangleCustomProps 或 applyMinify 呼叫——這能保證所有檔案使用相同的名稱對應。

先處理 token 工作表,讓其名稱先被種入清單(manifest),然後元件工作表再加入它們(通常是重疊的)參考。