库的StylePreprocessOptions,在angular.json中应该放在哪里?
我正在尝试使用库的StylePreprocessOptions,在angular.json中应该放在哪里?,angular,Angular,我正在尝试使用stylepreprocessions为库项目包含到我的变量文件夹的路径,如下所示: "stylePreprocessorOptions": { "includePaths": [ "styles/variables" ] } 然后我使用@import'colors'。但在发球时它不起作用: @import 'colors'; ^ Can't find stylesheet to import. 以下是angular.json中的完整库
stylepreprocessions
为库项目包含到我的变量文件夹的路径,如下所示:
"stylePreprocessorOptions": {
"includePaths": [
"styles/variables"
]
}
然后我使用@import'colors'。但在发球时它不起作用:
@import 'colors';
^
Can't find stylesheet to import.
以下是angular.json中的完整库:
"ui-table": {
"root": "libs/ui/table",
"sourceRoot": "libs/ui/table/src",
"projectType": "library",
"prefix": "xxx",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "libs/ui/table/tsconfig.lib.json",
"project": "libs/ui/table/ng-package.json",
"stylePreprocessorOptions": {
"includePaths": [
"styles/variables"
]
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["libs/ui/table/tsconfig.lib.json"],
"exclude": ["**/node_modules/**"]
}
}
},
"schematics": {
"@nrwl/schematics:component": {
"styleext": "scss"
}
}
},
如何在Angular中的库中使用样式预处理器
谢谢 不在angular.json中
在libraries的ng-package.json中包含带有styleIncludePaths
的scss文件夹路径
"lib": {
"entryFile": "src/public-api.ts",
...
"styleIncludePaths": [
"relative/path/to/scss/folder"
]
...
}
最后从引用的scss文件夹导入文件,不带前缀路径,如下所示
@import "filename";
@GreatHawkeye请接受这一正确答案,如果它能像我一样解决你的问题。