-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
67 lines (64 loc) · 1.9 KB
/
index.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import postcsspresetenv from 'postcss-preset-env';
import autoprefixer from 'autoprefixer';
import cssnano from 'cssnano';
// running purgecss only in production so we can use all available classes in development
const purgecss =
process.env.HUGO_ENVIRONMENT === 'production'
? // @ts-ignore
require('@fullhuman/postcss-purgecss')({
content: ['./hugo_stats.json'],
// https://github.com/gohugoio/hugo/issues/10338
// https://discourse.gohugo.io/t/purgecss-and-highlighting/41021
safelist: {
greedy: [/highlight/, /chroma/, /widget--web-vitals/, /dark/],
},
fontFace: true,
//variables: true,
keyframes: true,
defaultExtractor: (/** @type {string} */ content) => {
const els = JSON.parse(content).htmlElements;
return [
...(els.tags || []),
...(els.classes || []),
...(els.ids || []),
];
},
})
: null;
export default {
plugins: [
// https://github.com/anandthakker/doiuse
// doiuse({
// browsers: [
// "extends @davidsneighbour/browserslist-config",
// ],
// ignore: ['rem'],
// ignoreFiles: ['**/normalize.css'],
// }),
purgecss,
// https://github.com/postcss/autoprefixer
autoprefixer(),
// https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env
// @ts-ignore
postcsspresetenv({
stage: 2,
browsers: ['extends @davidsneighbour/browserslist-config'],
// https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-preset-env/FEATURES.md
features: {
'nesting-rules': true,
},
//debug: true,
}),
// https://cssnano.github.io/cssnano
cssnano({
preset: [
'default',
{
discardComments: {
removeAll: true,
},
},
],
}),
],
};