angular-cli工具的--base-href和--deploy-url参数之间有什么区别 [英] What's the difference between --base-href and --deploy-url parameters of angular-cli tool
问题描述
Angular的文档通知我,当将其部署在服务器的子文件夹中时,应该在Angular应用程序构建中使用--base-href
参数进行生产:
The documentation of Angular informs I should use --base-href
parameter in the Angular application build for production when it's going to be deployed in a subfolder of server:
如果将文件复制到服务器子文件夹中,请附加build标志,
--base-href
并适当设置<base href>
.
If you copy the files into a server sub-folder, append the build flag,
--base-href
and set the<base href>
appropriately.
例如,如果index.html
在服务器上的/my/app/index.html
,
像这样将基本href设置为<base href="/my/app/">
.
For example, if the index.html
is on the server at /my/app/index.html
,
set the base href to <base href="/my/app/">
like this.
https://angular.io/guide/deployment
但是,angular-cli具有--deploy-url
参数.该工具的文档将其描述为:
However, the angular-cli has the --deploy-url
parameter. The documentation of tool describes it as:
将在其中部署文件的URL.
URL where files will be deployed.
https://github.com/angular/angular-cli/wiki/build
当应用程序要部署在服务器的子文件夹中时,我已经看到了使用--base-href
的--deploy-url
插入的解决方案.
I have seen solutions that use the --deploy-url
insted of --base-href
when the application is going to be deployed in a subfolder of server.
angular-cli工具的--base-href
和--deploy-url
参数之间有什么区别?我应该何时使用每个?
What's the difference between --base-href
and --deploy-url
parameters of angular-cli tool? When should I use each one?
推荐答案
-
正在使用
- Base-href
- 部署网址用于资产.
- Base-href is being used by routing
- deploy-url is for assets.
在大多数情况下,base-href就足够了.
In most cases base-href is enough.
请参阅以下帖子:
https://shekhargulati.com/2017/07/06/angular-4-use-of-base-href-and-deploy-url-build-options/
这篇关于angular-cli工具的--base-href和--deploy-url参数之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!