-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathpostcss.config.js
More file actions
37 lines (31 loc) · 858 Bytes
/
postcss.config.js
File metadata and controls
37 lines (31 loc) · 858 Bytes
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
const tailwindcss = require('tailwindcss');
const atImport = require('postcss-import');
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
const plugins = [atImport, tailwindcss];
if (IS_PRODUCTION) {
const purgecss = require('@fullhuman/postcss-purgecss');
class TailwindExtractor {
static extract(content) {
return content.match(/[A-z0-9-:/]+/g) || [];
}
}
plugins.push(
purgecss({
content: [
'src/*.html',
'src/**/*.js',
'devtools/**/*.js',
'devtools/**/*.html',
],
whitelist: ['body', /CodeMirror/, /react-toggle/, /data-reach/],
whitelistPatternsChildren: [
/CodeMirror/,
/cm-s-dracula/,
/react-toggle/,
/data-reach/,
],
defaultExtractor: TailwindExtractor.extract,
}),
);
}
module.exports = { plugins };