diff --git a/assets/hb/purgecss.config.js b/assets/hb/purgecss.config.js index 6037055..75803f6 100644 --- a/assets/hb/purgecss.config.js +++ b/assets/hb/purgecss.config.js @@ -1,3 +1,4 @@ +let purgeCSSPlugin = requireX('@fullhuman/postcss-purgecss') const stats = './hugo_stats.json' const path = require('path') const fs = require('fs') @@ -35,7 +36,12 @@ 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. + console.error(111) + purgeCSSPlugin = purgeCSSPlugin.purgeCSSPlugin +} +const purgecss = purgeCSSPlugin({ content: [stats], defaultExtractor: (content) => { let els = JSON.parse(content).htmlElements