inc*_*oxe 4 css compiler-errors sass undefined
我在编写 SCSS 时遇到了未定义变量错误。
\ncolor: #f22437与color: $clr-primary
Error: Undefined variable.\n \xe2\x95\xb7\n54 \xe2\x94\x82 color: $clr-primary;\n \xe2\x94\x82 ^^^^^^^^^^^^\n \xe2\x95\xb5\n scss/layouts/_navigation.scss 54:10 @use\n scss/layouts/_all-layouts.scss 11:1 @use\n scss/main.scss 7:1 root stylesheet\nRun Code Online (Sandbox Code Playgroud)\n有问题的文件。
\n\n\n更新我将所有@use 更改为@import,并且它有效。
\n请帮助我理解为什么这有效以及我如何使用 @use 而不是 @import。似乎是与 SASS 有关的问题,但我仍然可能有错。现在我将“破解”它。
\n小智 5
我遇到了同样的问题,在阅读文档后,他们这样说:
使用 @use 加载的成员(变量、函数和 mixin)仅在加载它们的样式表中可见。如果其他样式表也想访问它们,则需要编写自己的 @use 规则。这有助于轻松准确地弄清楚每个成员来自哪里。如果您想一次从多个文件中加载成员,可以使用转发规则从一个共享文件中转发所有成员。
解决方案:
namespace.variablename
Run Code Online (Sandbox Code Playgroud)