-
Notifications
You must be signed in to change notification settings - Fork 5
/
postcss.config.js
50 lines (49 loc) · 2.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
48
49
50
const APP = require('./app.config');
const ENV = require('./app.env');
module.exports = {
plugins: [
require('postcss-devtools')({ precise: true }),
require('./postcss.stylelint')(),
...(ENV.PROD || ENV.DEBUG
? [
require('postcss-focus')({ oldFocus: true }),
require('postcss-focus-visible')(),
require('postcss-focus-within')(),
require('postcss-font-display')([{ display: 'swap' }, { test: 'FontAwesome', display: 'block' }]),
require('postcss-flexbugs-fixes')(),
...(APP.AVIF ? [require('./postcss.resize')('avif')] : []),
...(APP.WEBP ? [require('./postcss.resize')('webp')] : []),
...(!ENV.DEBUG
? [
...(APP.SORT_MEQIA_QUERIES
? [
require('postcss-sort-media-queries')({
sort: APP.SORT_MEQIA_QUERIES,
onlyTopLevel: true,
}),
]
: []),
require('cssnano')({
preset: [
'default',
{
minifyFontValues: { removeQuotes: false },
discardComments: { removeAll: true },
},
],
}),
]
: []), // this always last
]
: []),
require('autoprefixer')({
overrideBrowserslist: ENV.BROWSERS,
}), // this always last
require('./postcss.resolve-absolute')({
silent: !(ENV.PROD || ENV.DEBUG),
}),
require('postcss-browser-reporter')(),
require('./postcss.reporter')(), // this always last
...(!(ENV.DEV_SERVER || ENV.WATCH) && !ENV.DEBUG ? [require('postcss-fail-on-warn')()] : []), // this always last
],
};