From 379e9ce5ffc509fd1ca2fcc32b81b7e9c355ca08 Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Sat, 10 Feb 2024 09:44:18 -0500 Subject: [PATCH] Fix postcss --- config.yaml | 5 ++++- themes/hugo-theme-gruvbox/postcss.config.js | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 2ae04fab..7f423a00 100644 --- a/config.yaml +++ b/config.yaml @@ -4,7 +4,10 @@ copyright: Dave Gallant title: davegallant.ca enableGitInfo: true enableRobotsTXT: true -noJSConfigInAssets: true + +build: + noJSConfigInAssets: true + writeStats: true params: author: Dave Gallant diff --git a/themes/hugo-theme-gruvbox/postcss.config.js b/themes/hugo-theme-gruvbox/postcss.config.js index 95389a8b..4a1c68bf 100644 --- a/themes/hugo-theme-gruvbox/postcss.config.js +++ b/themes/hugo-theme-gruvbox/postcss.config.js @@ -25,6 +25,14 @@ module.exports = () => ({ ? [ require("postcss-preset-env"), require("cssnano"), + require("@fullhuman/postcss-purgecss")({ + content: ["./hugo_stats.json"], + defaultExtractor: (content) => { + let els = JSON.parse(content).htmlElements; + return els.tags.concat(els.classes, els.ids); + }, + safelist: ["data-theme"], + }), ] : []), ],