我在 nestjs 中使用了 postcss-nesting 来支持 css 嵌套使用(不要问为什么不用 sass ),嵌套使用都没什么问题,但是当我想使用全局作用域声明一个全局规则时,报错了。 代码如下
.a {
font-size: 12px;
:global {
.xxxx {
font-size: 14px;
}
}
& :global(.xxxx) {
font-size: 14px;
}
&:global {
.xxxx {
font-size: 14px;
}
}
}
前面带上 & 不报错,但是也不生效。 配置如下
{
"plugins": [
"postcss-flexbugs-fixes",
[
"postcss-preset-env",
{
"autoprefixer": {
"flexbox": "no-2009"
},
"stage": 3,
"features": {
"custom-properties": false
}
}
],
"postcss-nesting"
]
}
有没有人遇到或者使用过类似的能帮我解答一下。谢谢
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.