-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpostcss.config.js
38 lines (30 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
31
32
33
34
35
36
37
38
/* eslint-disable */
const postcssImport = require('postcss-import');
const purgecss = require('@fullhuman/postcss-purgecss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const tailwindcss = require('tailwindcss');
const tailwindcssConfig = require('./tailwind.config');
const production = process.env.NODE_ENV === 'production';
module.exports = {
plugins: [
postcssImport(),
autoprefixer(),
tailwindcss(tailwindcssConfig),
production &&
purgecss({
content: [`${__dirname}/**/*.html`],
defaultExtractor: (content) => {
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || [];
const innerMatches =
content.match(/[^<>"'`\s.()]*[^<>"'`\s.():]/g) || [];
return broadMatches.concat(innerMatches);
},
}),
production &&
cssnano({
preset: ['default', { discardComments: { removeAll: true } }],
}),
].filter(Boolean),
sourceMap: true,
};