-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostcss.config.js
65 lines (63 loc) · 1.43 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const customExtractor = content => {
const regExp = new RegExp( /[A-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;
}
module.exports = {
plugins: {
// 'postcss-import': {
// from: 'src/global.css',
// },
// 'postcss-nested': {},
'autoprefixer': {
add: true,
},
// 'postcss-reporter': { clearReportedMessages: true },
...process.env.NODE_ENV == 'development' ? {} : {
'@fullhuman/postcss-purgecss': {
content: [
'./*.php',
'./src/**/*.php',
//'./lib/**/*.php',
'./page-templates/**/*.php',
'./woocommerce/**/*.php',
'./src/**/*.js',
],
safelist: {
greedy: [
/align/,
/float/,
/srt/,
/^bg-/,
/^is-/,
/^ra-/,
/^i-/,
/!important/
],
deep: [
/table/,
/Cart/,
/woocommerce/,
/wp-/,
],
},
extractors: [ {
extractor: customExtractor,
extensions: ['php', 'js' ]
} ]
},
'cssnano': {
preset: [ 'default', {} ],
}
},
}
};