forked from LiveTL/LiveTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postcss.config.js
53 lines (50 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
53
/* eslint-disable @typescript-eslint/no-var-requires */
const extractor = require('smelte/src/utils/css-extractor.js');
const tailwindConfig = require('./tailwind.config.js');
const safelistSelectors = [
'html',
'body',
'stroke-primary',
'mode-dark',
// Components with custom color prop might need its color to be whitelisted too
'bg-blue-500',
'hover:bg-blue-400',
'text-alert-500'
];
const safelistPatterns = [
// for JS ripple
/ripple/,
// date picker
/w-.\/7/,
// I'm guessing it doesn't correlate p-2.5 with p-2\.5
/^[mphw]\w?-\d\.5$/
];
module.exports = (purge = false) => {
const postcss = [];
return [
require('postcss-import')(),
require('postcss-url')(),
require('postcss-input-range')(),
require('autoprefixer')(),
require('tailwindcss')(tailwindConfig),
...postcss,
purge &&
require('cssnano')({
preset: 'default'
}),
purge &&
require('@fullhuman/postcss-purgecss')({
content: ['./**/*.svelte'],
extractors: [
{
extractor,
extensions: ['svelte']
}
],
safelist: {
standard: safelistSelectors,
deep: safelistPatterns
}
})
].filter(Boolean);
};