-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpostcss.config.js
39 lines (36 loc) · 1.38 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
import { purgeCSSPlugin } from '@fullhuman/postcss-purgecss'
import autoprefixer from 'autoprefixer'
import tailwindcss from 'tailwindcss'
const IN_PRODUCTION = process.env.NODE_ENV === 'production'
export default {
plugins: [
tailwindcss,
autoprefixer,
IN_PRODUCTION &&
// Reference https://github.com/Developmint/nuxt-purgecss/blob/main/src/config.ts
purgeCSSPlugin({
content: ['./**/*.html', './src/**/*.vue'],
defaultExtractor(content) {
const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '') // Remove inline vue styles
return contentWithoutStyleBlocks.match(/[\w-.:/]+(?<!:)/g) || [] // Default extractor
},
safelist: [
'body',
'html',
/-(leave|enter|appear)(|-(to|from|active))$/, // Normal transitions
/^router-link(|-exact)-active$/, // Router link classes
/^(?!(|.*?:)cursor-move).+-move$/, // Move transitions
/.*data-v-.*/, // Keep scoped styles
/^active/,
// Vue3 selectors
/:slotted/,
/:deep/,
/:global/,
/nuxt-devtools-.*/,
// Tailwind classes
/.*-\[.*\]/, // Matches all classes with `-[...]` (Tailwind JIT classes)
/^(!)?[a-z]+:!?.*/, // Matches responsive and important modifiers, like `md:!text-emerald-500`
],
}),
],
}