Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextjs如何使用 #25

Open
maoxuanlong opened this issue Jul 29, 2023 · 2 comments
Open

nextjs如何使用 #25

maoxuanlong opened this issue Jul 29, 2023 · 2 comments

Comments

@maoxuanlong
Copy link

如题,nextjs如何使用,使用以下方式失效
plugins:{ 'postcss-px-to-viewport-8-plugin': { // 视窗的宽度,对应的是我们设计稿的宽度,我们公司用的是375 viewportWidth: 750, // 视窗的高度,根据750设备的宽度来指定,一般指定1334,也可以不配置 // viewportHeight: 1334, // 指定px转换为视窗单位值的小数位数 unitPrecision: 3, // 指定需要转换成的视窗单位,建议使用vw viewportUnit: 'vw', // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名 selectorBlackList: ['.ignore'], // 小于或等于1px不转换为视窗单位,你也可以设置为你想要的值 minPixelValue: 1, // 允许在媒体查询中转换px mediaQuery: false // exclude: undefined } }

@BenjaminCCG
Copy link

同问

@ZhuAiQuan
Copy link

是能正常使用的,配置postcss.config.js即可。
next.js 14.1.4
postcss-px-to-viewport-8-plugin ^1.2.5
`

module.exports = {
plugins: {
'postcss-px-to-viewport-8-plugin': {
unitToConvert: 'rpx',
viewportWidth: 375,
unitPrecision: 10,
propList: ['*'],
viewportUnit: 'vw',
fontViewportUnit: 'vw',
selectorBlackList: [],
minPixelValue: 0,
mediaQuery: false,
replace: true,
exclude: [],
landscape: false,
landscapeUnit: 'vw',
landscapeWidth: 568,
},
},
};

`
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants