将共享资产包括在Angular中 [英] Include Shared Assets In Angular
问题描述
我已经创建了一个角度工作区,其中包含多个角度项目和库.
I have create a angular workspace which host multiple angular projects and libraries.
在工作区中,我有一个共享库,其中包含所有资产(图像和徽标).
In workspace I have a shared library which contains all assets(images and logos).
"assets": [
"projects/xxx-workspace/src/favicon.ico",
"projects/xxx-workspace/src/assets",
"projects/xxx-shared/src/lib/images"
]
"projects/xxx-shared/src/lib/images"
但是在构建应用程序时会引发错误:-
But while building the application it throws error:-
资产路径必须以项目源根开头.
asset path must start with the project source root.
实现此目标的预期配置是什么.
What is the expected configuration to achieve this.
推荐答案
希望您已经弄清楚了.在nrwl connect上有关于此的食谱文章. https://connect.nrwl.io/app/cookbook/3lUhYk6aXO4kiKqfTfj3fs .简而言之,angular cli不允许您使用该语法引用项目源之外的资产,因此,您可以使用以下语法 https://angular.io/guide/workspace-config#assets-configuration
Hope you got this figured out. There is a cookbook article about this on nrwl connect https://connect.nrwl.io/app/cookbook/3lUhYk6aXO4kiKqfTfj3fs. In short, angular cli doesn't let you reference assets outside the project source in that syntax, so to do this you can use this syntax https://angular.io/guide/workspace-config#assets-configuration
"assets": [
{
"input": "libs/my-lib/src/lib/assets",
"glob": "*.png",
"output": "assets"
}
]
这篇关于将共享资产包括在Angular中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!