-
Notifications
You must be signed in to change notification settings - Fork 114
/
postcss.config.js
45 lines (40 loc) · 1022 Bytes
/
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
// LightningCSS settings
// https://lightningcss.dev/
//
// Support browsers with at least 0.25% usage from broswerlist: https://browserslist.dev/?q=bGFzdCAyIHZlcnNpb25z
const postcssLightningcss = require("postcss-lightningcss")({
browsers: ">= .25%",
lightningcssOptions: {
}
});
// PurgeCSS settings
// https://purgecss.com/
//
// Load hugo_stats.json to know what elements are in use
const purgecss = require('@fullhuman/postcss-purgecss')({
content: ['./hugo_stats.json'],
variables: true,
defaultExtractor: content => {
const els = JSON.parse(content).htmlElements;
return [
...(els.tags || []),
...(els.classes || []),
...(els.ids || []),
];
},
safelist: []
});
// PostCSS Media sort
// https://github.com/yunusga/postcss-sort-media-queries
//
// Sort CSS to prioritize desktop users
const mediasort = require('postcss-sort-media-queries')({
sort: 'desktop-first'
});
module.exports = {
plugins: [
purgecss,
mediasort,
postcssLightningcss
]
};