forked from BustByte/coronastatus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostcss.config.js
52 lines (48 loc) · 1.23 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
/**
* Big thanks to the instructions here!
* https://flaviocopes.com/tailwind-setup/
*/
const tailwindcss = require('tailwindcss');
const purgecss = require('@fullhuman/postcss-purgecss');
const cssnano = require('cssnano');
const autoprefixer = require('autoprefixer');
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
class TailwindExtractor {
static extract(content) {
return content.match(/[A-z0-9-:\/]+/g);
}
}
// Add colors here when you add them in the code
const colors = ['red', 'blue'];
module.exports = {
plugins: [
tailwindcss('tailwind.config.js'),
cssnano({
preset: 'default'
}),
purgecss({
content: ['app/views/pages/*.ejs', 'app/views/partials/*.ejs'],
whitelist: colors.reduce((list, color) => {
// Add classes here when you add them in alert.ejs
list.push(
`bg-${color}-100`,
`text-${color}-400`,
`border-${color}-400`,
`text-${color}-700`
);
return list;
}, []),
extractors: [
{
extractor: TailwindExtractor,
extensions: ['html', 'js', 'ejs']
}
]
}),
autoprefixer
]
};