【发布时间】:2020-08-20 22:39:29
【问题描述】:
我想在 scss 文件中使用 angular 的样式作为短地址。
我通过这种方式使用样式:
我在src 文件夹中创建一个文件夹并将样式放在上面:
然后我去angular-cli.json 并添加这个:
"stylePreprocessorOptions": {
"includePaths": [
"src",
"src/stylings/",
"src/stylings/base/",
"src/stylings/kt-customs/"
]
},
我需要像这样在style.css 中使用它:
@import "custom-form";
@import "custom-buttons";
@import "custom-table";
@import "custom-filter";
@import "kt-customise";
但它告诉我这个错误:
> ./src/styles.scss 中的错误 (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src ??embedded!./node_modules/sass-loader/dist/cjs.js??ref--13-3!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs .js??ref--17-1!./src/styles.scss) 模块构建失败(来自 ./node_modules/sass-loader/dist/cjs.js): SassError:找不到要导入的样式表。 ╷ 9 │ @import "自定义表单"; │ ^^^^^^^^^^^^^ ╵ E:\MyProject\Ava\PFA\demo\src\styles.scss 9:9 根样式表
我该如何解决这个问题????
【问题讨论】:
-
您找到解决方案了吗?
includePaths中是否需要包含所有可能的路径?
标签: javascript angular typescript webpack