-
Notifications
You must be signed in to change notification settings - Fork 19
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
postcss-mobile-forever版本4.1.2在 Vue3 vite5 配置不生效 #29
Comments
您试着调换一下 PostCSS 的插件顺序,我记得插件执行的顺序是从后向前的,所以 tailwindcss 应该放在最后,类似这样: css: {
postcss: {
plugins: [
- tailwindcss,
autoprefixer,
- loader_pxtovw,
posMobile({
viewportWidth: 375,
maxDisplayWidth: 580,
appSelector: "#mobile"
}),
+ tailwindcss,
]
}
} 这里面有个 loader_pxtovw 插件我不清楚作用,估计是和 mobile-forever 作用重叠的,也给你取掉了,您试试这么改完看看效果是什么样的。 |
我发现一些奇怪的现象,例如: ❌ maxDisplayWidth 属性不生效 : html,
body,
#app {
height: 100%;
font-family: var(--van-base-font);
font-size: 28px;
background-color: var(--app-theme-background-color-body);
color: var(--app-theme-text-color-1);
} ❌ maxDisplayWidth 属性不生效 : html,
body {
height: 100%;
font-family: var(--van-base-font);
font-size: 28px;
background-color: var(--app-theme-background-color-body);
color: var(--app-theme-text-color-1);
}
#app {} ✅ maxDisplayWidth 属性生效 : html,
body {
height: 100%;
font-family: var(--van-base-font);
font-size: 28px;
background-color: var(--app-theme-background-color-body);
color: var(--app-theme-text-color-1);
}
#app {
+ height: 100%;
}
appSelector 一定要在样式中定义并且赋值,maxDisplayWidth 才生效 postcss.config.js 配置: export default {
plugins: {
'postcss-mobile-forever': {
viewportWidth: (file) => (file.includes('node_modules/vant') ? 375 : 750),
maxDisplayWidth: 600,
propertyBlackList: {
'.van-icon': 'font'
},
rootContainingBlockSelectorList: ['van-tabbar']
}
},
tailwindcss: {},
autoprefixer: {}
}; |
@Aisen60 前两个“❌ maxDisplayWidth 属性不生效” 的例子没看懂,是说 |
嗯嗯,应该是有其他插件做了消除空选择器样式代码优化 |
在vite.config.js配置如下
The text was updated successfully, but these errors were encountered: