-
Notifications
You must be signed in to change notification settings - Fork 24
/
postcss.config.cjs
37 lines (34 loc) · 1.12 KB
/
postcss.config.cjs
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
/* eslint-disable @typescript-eslint/no-var-requires */
// const { WeappTailwindcssDisabled } = require('./platform')
/**
* @type {import('postcss').AcceptedPlugin[]}
*/
const plugins = [require('tailwindcss')(), require('autoprefixer')()]
// 下方为 px 转 rpx 功能, 根据你自己的需求打开它
// if (!WeappTailwindcssDisabled) {
// plugins.push(
// require('postcss-pxtransform')({
// platform: 'weapp',
// // https://taro-docs.jd.com/docs/size
// // 根据你的设计稿宽度进行配置
// // 可以传入一个 function
// // designWidth (input) {
// // if (input.file.replace(/\\+/g, '/').indexOf('@nutui/nutui-taro') > -1) {
// // return 375
// // }
// // return 750
// // },
// designWidth: 750, // 375,
// deviceRatio: {
// 640: 2.34 / 2,
// // 此时应用到的规则,代表 1px = 1rpx
// 750: 1,
// 828: 1.81 / 2,
// // 假如你把 designWidth 设置成 375 则使用这条规则 1px = 2rpx
// 375: 2 / 1
// }
// })
// )
// }
plugins.push(require('weapp-tailwindcss/css-macro/postcss'))
module.exports = plugins