首頁 > purgecss > PurgeCSS

PurgeCSS 類別

用於建立 PurgeCSS 的類別,然後可使用它來清除 CSS 檔案。

簽章

declare class PurgeCSS 

範例

await new PurgeCSS().purge({
   content: ['index.html'],
   css: ['css/app.css']
})

屬性

屬性修改器類型說明
options選項
removedNodespostcss.Node[]
selectorsRemovedSet<string>
variablesStructureVariablesStructure

方法

方法修改器說明
extractSelectorsFromFiles(files, extractors)使用 PurgeCSS 抽取器從檔案中抽取選擇器
extractSelectorsFromString(content, extractors)使用 PurgeCSS 抽取器從傳遞的字串中抽取選擇器
getPurgedCSS(cssOptions, selectors)根據檔案取得清除後的 CSS 版本
purge(userOptions)移除未使用的 CSS
removeUnusedCSSVariables()移除未使用的 CSS 變數
removeUnusedFontFaces()移除未使用的字型
removeUnusedKeyframes()移除未使用的關鍵影格
walkThroughCSS(root, selectors)遍歷 CSS AST 並移除未使用的 CSS