-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostcss.config.mjs
More file actions
32 lines (30 loc) · 882 Bytes
/
postcss.config.mjs
File metadata and controls
32 lines (30 loc) · 882 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
/**
* PostCSS 配置
*
* @see https://tailwindcss.com/docs/installation/vite
*/
const isProduction = process.env.NODE_ENV === 'production';
export default {
plugins: {
// 自动添加浏览器前缀
autoprefixer: {},
// 仅在生产环境中压缩 CSS
...(isProduction && {
cssnano: {
preset: [
'default',
{
// 移除所有注释
discardComments: { removeAll: true },
// 规范化空白
normalizeWhitespace: true,
// 合并相同规则
mergeRules: true,
// 移除重复规则
discardDuplicates: true,
},
],
},
}),
},
};