-
Notifications
You must be signed in to change notification settings - Fork 5
/
postcss.config.js
30 lines (29 loc) · 1012 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
const production = !process.env.ROLLUP_WATCH;
module.exports = {
plugins: [
require('postcss-import'),
require('postcss-import-url'),
production &&
require('@fullhuman/postcss-purgecss')({
content: ['./src/**/*.svelte', './assets/__app.html'],
whitelist: ['svg:not(:root).svg-inline--fa'],
whitelistPatterns: [/svelte-/, /^fa-/, /^svg-inline--fa/],
whitelistPatternsChildren: [/^token/, /^pre/, /^code/],
defaultExtractor: (content) => {
const regExp = new RegExp(/[A-Za-z0-9-_:/]+/g);
const matchedTokens = [];
let match = regExp.exec(content);
while (match) {
if (match[0].startsWith('class:')) {
matchedTokens.push(match[0].substring(6));
} else {
matchedTokens.push(match[0]);
}
match = regExp.exec(content);
}
return matchedTokens;
},
}),
require('postcss-preset-env')({ stage: 1 }),
],
};