gpt4 book ai didi

angular - stylePreprocessorOptions 不适用于@Angular/cli 7

转载 作者:太空狗 更新时间:2023-10-29 17:32:19 28 4
gpt4 key购买 nike

所以,我正在尝试“whitelabelyze”我的应用程序,允许为多个客户提供多种设计选项。在我的组件的 scss 中,我需要加载一个位于“主题”文件夹下的“_variables.scss”,结构如下:

/
- themes
-- client-1
--- _variables.scss
-- client-2
--- _variables.scss

在我的 angular.json 中,我有这个配置:

"projects": {
"client-1": {
...
"architect": {
"build": {
...
"options": {
...
"stylePreprocessorOptions": {
"includePaths": [
"themes/client-1"
]
},
"styles": [
"src/styles.scss",
]
...
}
...
}
},

"client-2": {
...
"architect": {
"build": {
...
"options": {
...
"stylePreprocessorOptions": {
"includePaths": [
"themes/client-2"
]
},
"styles": [
"src/styles.scss",
]
...
}
...
}
}
}

根据documentation ,我做得对,但我的 scss 文件没有正确加载文件“变量”。这是对我的 scss 文件的导入:

@import "variables";

这是发生的错误:

ERROR in ./src/app/app.component.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):

@import "variables";
^
File to import not found or unreadable: variables.
in /Users/erick/Projects/sample-project/src/styles.scss (line 2, column 1)

有什么关于如何处理这里的建议吗?

最佳答案

我发现了问题。

我在 angular.json 中加载了 themes/client-X 而不是 src/themes/client-X

关于angular - stylePreprocessorOptions 不适用于@Angular/cli 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52971392/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com