-
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
vite+vue3+ts+vant4 + sass遇见scoped不生效 #48
Comments
是加上 |
对的,scss加上后不转换 |
Ok,我这两天看看 |
方便给个最小包吗? |
应该是我不规范导致的,我用了uno css还在写scss,可能是这个原因 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题:
1.示例
<style lang="scss" scoped></style>结果:
结果:
配置如下:
css: {
preprocessorOptions: {
scss: {
// 引入scss全局变量文件
additionalData:
@use "@/assets/styles/base.scss" as *;
}
},
postcss: './postcss.config.cjs'
},
`
postcss.config.cjs文件:
module.exports = {
plugins: [
require('postcss-mobile-forever')({
appSelector: '#app',
viewportWidth: 375,
maxDisplayWidth: 600,
rootContainingBlockSelectorList: ['van-tabbar', 'van-popup'],
exclude: [/node_modules/]
}),
require('autoprefixer')({
overrideBrowserslist: ['> 1%', 'last 2 versions', 'not dead']
})
]
}
base.scss
*,
*::before,
*::after {
box-sizing: border-box;
}
#app {
height: 100vh;
}
不清楚是什么原因,如果直接使用less在main.ts引入less样式文件则可以正常使用
The text was updated successfully, but these errors were encountered: