【问题标题】:@import SCSS files not recognized by compiler?@import SCSS 文件无法被编译器识别?
【发布时间】:2021-07-01 21:41:28
【问题描述】:

它不会编译它说:

未定义变量:“$blue-logo-color。”

在 variables.scss 我有:

$blue-logo-color: #3cabf5;

在 site.scss 我有:

@import "variables.scss"

.blue-logo-color {
    color: $blue-logo-color;
}

.blue-logo-background-color {
    background-color: $blue-logo-color;
}

如何让 WebCompiler 包含编译器的全局 scss/css 文件?它似乎也无法识别来自 _Hosts.cshtml 的全局包含。

【问题讨论】:

  • 你需要在import语句的末尾加分号
  • 你是对的,解决了它。
  • 我可能应该将其添加为答案

标签: less blazor web-compiler ef-core-6-preview


【解决方案1】:

SCSS 导入语句需要分号

@import "variables.scss";

【讨论】:

  • 如何将 scss 文件导入作用域 scss 文件?编译器无法识别全局包含,并且在作用域文件中不允许使用 @import,例如:Index.razor.scss can't use @import.
  • 我已经在作用域文件 (*page.razor.scss) 中导入,使用相对路径没有问题,例如:@import '../SCSS/Variables.scss';
  • 重启 Visual Studio 解决了作用域导入问题。
猜你喜欢
  • 2018-08-29
  • 1970-01-01
  • 2021-06-07
  • 2016-10-23
  • 1970-01-01
  • 1970-01-01
  • 2014-01-24
  • 1970-01-01
相关资源
最近更新 更多