-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostcss.config.js
61 lines (60 loc) · 3.06 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
54
55
56
57
58
59
60
61
// // const postcssPxToViewport8Plugin = require('postcss-px-to-viewport-8-plugin');
// module.exports = {
// plugins: {
// // [
// // postcssPxToViewport8Plugin({
// // unitToConvert: 'px', // 需要转换的单位,默认为"px"
// // viewportWidth: 1920, // 设计稿的视口宽度
// // unitPrecision: 5, // 单位转换后保留的精度
// // propList: ['*'], // 能转化为vw的属性列表
// // viewportUnit: 'vw', // 希望使用的视口单位
// // fontViewportUnit: 'vw', // 字体使用的视口单位
// // selectorBlackList: [], // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位
// // minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
// // mediaQuery: false, // 媒体查询里的单位是否需要转换单位
// // replace: true, // 否直接更换属性值,而不添加备用属性
// // exclude: [], // 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
// // landscape: false, // 是否添加根据 landscapeWidth 生成的媒体查询条件 @media (orientation: landscape)
// // landscapeUnit: 'vw', // 横屏时使用的单位
// // landscapeWidth: 568, // 横屏时使用的视口宽度
// // }),
// // ],
// 'postcss-px-to-viewport-8-plugin': {
// unitToConvert: 'px', // 需要转换的单位,默认为"px"
// viewportWidth: 1920, // 设计稿的视口宽度
// unitPrecision: 5, // 单位转换后保留的精度
// propList: ['*'], // 能转化为vw的属性列表
// viewportUnit: 'vw', // 希望使用的视口单位
// fontViewportUnit: 'vw', // 字体使用的视口单位
// selectorBlackList: [], // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位
// minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
// mediaQuery: false, // 媒体查询里的单位是否需要转换单位
// replace: true, // 否直接更换属性值,而不添加备用属性
// exclude: [], // 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
// landscape: false, // 是否添加根据 landscapeWidth 生成的媒体查询条件 @media (orientation: landscape)
// landscapeUnit: 'vw', // 横屏时使用的单位
// landscapeWidth: 568, // 横屏时使用的视口宽度
// },
// },
// };
// const postcssPxToViewport8Plugin = require('./lib');
module.exports = {
// plugins: [
// postcssPxToViewport8Plugin({
// // 设计稿宽度
// viewportWidth: 750,
// exclude: [/node_modules/],
// // 需要转换的单位,默认为"px"
// unitToConvert: 'px',
// }),
// ],
plugins: {
'postcss-px-to-viewport-8-plugin': {
// 设计稿宽度
viewportWidth: 1920,
exclude: [/node_modules/],
// 需要转换的单位,默认为"px"
unitToConvert: 'px',
},
},
};