matrix-spec/postcss.config.js
Johannes Marbach 13aa6e83ae
Some checks failed
Spec / 🔎 Validate OpenAPI specifications (push) Has been cancelled
Spec / 🔎 Check Event schema examples (push) Has been cancelled
Spec / 🔎 Check OpenAPI definitions examples (push) Has been cancelled
Spec / 🔎 Check JSON Schemas inline examples (push) Has been cancelled
Spec / ⚙️ Calculate baseURL for later jobs (push) Has been cancelled
Spec / 📢 Run towncrier for changelog (push) Has been cancelled
Spell Check / Spell Check with Typos (push) Has been cancelled
Spec / 🐍 Build OpenAPI definitions (push) Has been cancelled
Spec / 📖 Build the spec (push) Has been cancelled
Spec / 🔎 Validate generated HTML (push) Has been cancelled
Spec / 📖 Build the historical backup spec (push) Has been cancelled
Use more specific names for the version picker CSS classes and add them to the PurgeCSS safelist (#2264)
2025-12-05 18:06:17 +00:00

29 lines
973 B
JavaScript

// Remove unused CSS selectors.
const purgecss = require('@fullhuman/postcss-purgecss')({
content: [
// Use stats generated by Hugo from HTML content.
'./hugo_stats.json',
// Add used JS scripts.
process.env.HUGO_PUBLISHDIR + '/js/click-to-copy.min.*.js',
process.env.HUGO_PUBLISHDIR + '/js/main.min.*.js',
],
extractors: [
{
extractor: (content) => {
let els = JSON.parse(content).htmlElements;
return els.tags.concat(els.classes, els.ids);
},
extensions: ["json"],
},
],
// As these classes are only applied by JavaScript, PurgeCSS doesn't see them
// in the source code and removes them unless we explicitly tell it not to.
safelist: ['version-picker-selected', 'version-picker-latest']
});
module.exports = {
plugins: [
...(process.env.HUGO_ENVIRONMENT === 'production' ? [ purgecss ] : [])
]
};