diff --git a/aio/content/guide/deployment.md b/aio/content/guide/deployment.md index 2e61fc2316..8c3f2c9b40 100644 --- a/aio/content/guide/deployment.md +++ b/aio/content/guide/deployment.md @@ -451,6 +451,22 @@ the subfolder is `my/app/` and you should add `` to the se When the `base` tag is mis-configured, the application fails to load and the browser console displays `404 - Not Found` errors for the missing files. Look at where it _tried_ to find those files and adjust the base tag appropriately. +{@a deploy-url} + +## The `deploy` url + +A command line option used to specify the base path for resolving relative URLs for assets such as images, scripts, and style sheets at _compile_ time. For example: `ng build --deploy-url /my/assets`. + +The effects of defining a `deploy url` and `base href` can overlap. +* Both can be used for initial scripts, stylesheets, lazy scripts, and css resources. + +However, defining a `base href` has a few unique effects. +* Defining a `base href` can be used for locating relative template (HTML) assets, and relative fetch/XMLHttpRequests. + +The `base href` can also be used to define the Angular router's default base (see [APP_BASE_HREF](https://angular.io/api/common/APP_BASE_HREF)). Users with more complicated setups may need to manually configure the `APP_BASE_HREF` token within the application. (e.g., application routing base is / but assets/scripts/etc. are at /assets/). + +Unlike the `base href` which can be defined in a single place, the `deploy url` needs to be hard-coded into an application at build time. This means specifying a `deploy url` will decrease build speed, but this is the unfortunate cost of using an option that embeds itself throughout an application. That is why a `base href` is generally the better option. + {@a differential-loading} ## Differential Loading