I read through the Tailwind documentation a while back and made a manic version of a purge configuration
purge: {
enabled: process.env.HUGO_ENVIRONMENT === "production",
content: [
"./hugo_stats.json",
"./layouts/**/*.{vue,js,ts,jsx,tsx,html}",
"./assets/**/*.{vue,js,ts,jsx,tsx,html}",
],
extractors: [
{
extractor: (content) => {
// noinspection JSUnresolvedVariable
const els = JSON.parse(content).htmlElements;
return els.tags.concat(els.classes, els.ids);
},
extensions: ["json"],
},
],
// in case of missing styles read this part of the documentation
// https://tailwindcss.com/docs/optimizing-for-production#removing-all-unused-styles
mode: "all",
preserveHtmlElements: false,
safelist: ["text-center"],
// https://purgecss.com/configuration#options
options: {
// https://tailwindcss.com/docs/optimizing-for-production#removing-unused-keyframes
keyframes: true,
fontFace: true,
variables: true,
rejected: false,
},
},
You need to enable hugo_stats.json
generation.