Skip to content

Commit

Permalink
fix: compatible with the changes of @fullhuman/postcss-purgecss v7.0.0 (
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Nov 24, 2024
1 parent 17b2485 commit 56511db
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion assets/hb/purgecss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
let purgeCSSPlugin = requireX('@fullhuman/postcss-purgecss')
const stats = './hugo_stats.json'
const path = require('path')
const fs = require('fs')
Expand Down Expand Up @@ -35,7 +36,11 @@ try {
throw new Error(`Failed to parse runtime PurgeCSS config.\nPlease enable the "--renderToDisk" if you are using Hugo server.\n${err}`)
}

const purgecss = requireX('@fullhuman/postcss-purgecss')({
if (typeof purgeCSSPlugin !== 'function') {
// Compatible with v7.0.0.
purgeCSSPlugin = purgeCSSPlugin.purgeCSSPlugin
}
const purgecss = purgeCSSPlugin({
content: [stats],
defaultExtractor: (content) => {
let els = JSON.parse(content).htmlElements
Expand Down

0 comments on commit 56511db

Please sign in to comment.