-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostcss.config.js
More file actions
40 lines (39 loc) · 1.17 KB
/
postcss.config.js
File metadata and controls
40 lines (39 loc) · 1.17 KB
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
const path = require('path');
const comment = require('postcss-comment');
const tailwindcss = require('tailwindcss');
const autoprefixer = require('autoprefixer');
const postcssImport = require('postcss-import');
module.exports = {
parser: comment,
plugins: [
postcssImport({
resolve(id, basedir, importOptions) {
if (id.startsWith('~@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3));
} else if (id.startsWith('@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2));
} else if (id.startsWith('/') && !id.startsWith('//')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1));
}
return id;
},
}),
tailwindcss({
config: './tailwind.config.js',
}),
autoprefixer({
remove: true,
}),
require('postcss-rem-to-responsive-pixel')({
rootValue: 28, // 1:28比例(1rem = 28rpx)
propList: ['*'],
transformUnit: 'rpx',
// 排除不需要转换的类
selectorBlackList: [
'ignore-',
'untransform',
/^text-(xs|sm|base|lg|xl)$/, // 排除Tailwind字体类
],
}),
],
};