forked from matrix-org/matrix-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostcss.config.js
More file actions
25 lines (24 loc) · 744 Bytes
/
postcss.config.js
File metadata and controls
25 lines (24 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 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"],
},
],
});
module.exports = {
plugins: [
...(process.env.HUGO_ENVIRONMENT === 'production' ? [ purgecss ] : [])
]
};