【发布时间】:2020-01-13 11:38:31
【问题描述】:
如何在 Angular 中开启 sass-loader?
我尝试使用@import "theme.scss"; inside*.scss` 文件。
但我收到消息;
找不到或无法读取要导入的文件:theme.scss。
我不使用 webpack,只使用 tsconfig 和 angular.jon
文件 theme.scss 包含变量:
$border-radius: 10px;
$main: rgb(20, 100, 192);
【问题讨论】:
-
您确定
theme.scss文件与您要导入的scss文件位于同一目录中吗? -
根目录下没有这个文件。但我需要从项目中的任何地方获取此文件
-
可能我可以在 tsconfig 中设置路径规则或如何设置?
-
尝试修改 angular.json 项目 > projectName > Architects > build > options > ````"stylePreprocessorOptions": { "includePaths": [ "the/path" ] },```