mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-22 19:24:10 +01:00
It turns out that we were purging too much CSS which broke their style. We use a simple but lazy solution that parses the JS scripts and keeps the matching selectors. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
26 lines
732 B
JavaScript
26 lines
732 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.js',
|
|
process.env.HUGO_PUBLISHDIR + '/js/main.js',
|
|
],
|
|
extractors: [
|
|
{
|
|
extractor: (content) => {
|
|
let els = JSON.parse(content).htmlElements;
|
|
return els.tags.concat(els.classes, els.ids);
|
|
},
|
|
extensions: ["json"],
|
|
},
|
|
],
|
|
});
|
|
|
|
module.exports = {
|
|
plugins: [
|
|
...(process.env.HUGO_ENVIRONMENT === 'production' ? [ purgecss ] : [])
|
|
]
|
|
};
|