Ruby on rails 已忽略自定义属性:未将范围限定到规则中的顶级:根元素(:root{…--font size tiny:…})
在我的rails应用程序中,我从webpacker开发服务器收到以下警告:Ruby on rails 已忽略自定义属性:未将范围限定到规则中的顶级:根元素(:root{…--font size tiny:…}),ruby-on-rails,webpacker,Ruby On Rails,Webpacker,在我的rails应用程序中,我从webpacker开发服务器收到以下警告: Custom property ignored: not scoped to the top-level :root element (:root { ... --font-size-tiny: ... }), in atrule 更多信息,以获取更多自定义属性。 因此,当使用属性时,我会收到警告: variable '--font-size-tiny' is undefined and used without a
Custom property ignored: not scoped to the top-level :root element (:root { ... --font-size-tiny: ... }), in atrule
更多信息,以获取更多自定义属性。
因此,当使用属性时,我会收到警告:
variable '--font-size-tiny' is undefined and used without a fallback
css如下所示:
:root {
--font-size-tiny: 0.8125rem;
--line-height-tiny: 1rem;
...
}
@media screen and (min-width:26.5625rem) {
:root {
--font-size-tiny: calc(0.8125rem + 0 * (100vw - 26.5625rem) / 21.4375);
--line-height-tiny: calc(1rem + 0 * (100vw - 26.5625rem) / 21.4375);
...
}
}
我不理解这个警告,因为属性的作用域显式限定为:root
我尝试的是:
- 更改:root为html。同样的问题,同样的警告
- 使用rails和webpacker构建一个简单的Hello World应用程序。我认为webpacker可能在自定义属性方面存在问题。但没问题,Hello World应用程序可以处理范围为:root的自定义属性