forked from razonyang/hugo-theme-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostcss.config.js
47 lines (43 loc) · 1.19 KB
/
postcss.config.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const stats = './hugo_stats.json';
const fs = require('fs');
fs.access(stats, fs.F_OK, (err) => {
if (err) {
throw new Error('Hugo stats file not found, please turn on the build.writeStats.\n\n# /config/_default/config.toml\n[build]\n writeStats = true\n')
}
});
const purgecss = require('@fullhuman/postcss-purgecss')({
content: [ stats ],
defaultExtractor: (content) => {
let els = JSON.parse(content).htmlElements;
return els.tags.concat(els.classes, els.ids);
},
safelist: {
standard: [
'active',
'bottom-0',
'col-lg-10',
'd-flex',
'end-0',
'fs-lg', 'fs-sm', 'fs-xl', 'fs-xs', 'fst-italic',
'justify-content-center',
'mb-0',
'opacity-0', 'opacity-50',
'pe-3', 'pt-1', 'position-absolute', 'position-fixed', 'position-relative', 'position-sticky',
'show',
'text-pre-wrap', 'text-uppercase', 'text-white', 'top-0',
'w-100',
],
// deep: [/blue$/],
greedy: [/carousel-indicators$/]
},
dynamicAttributes: ["data-bs-popper"]
});
const autoprefixer = require('autoprefixer');
const rtlcss = require('rtlcss');
module.exports = {
plugins: [
rtlcss,
autoprefixer,
purgecss,
]
}