Skip to content

Commit

Permalink
docs: update deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Feb 1, 2024
1 parent 9841a69 commit 49a94c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions docs/deploy.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,14 @@ npm run analyze:view

## Release

When you are ready to deploy (release) your the app, you need only to publish the generated build artifacts - that is, the files in the `dist` folder - to your cdn or static server. Note that the `index.html` is usually the entry page for your app and handles all missing file requests. You may need to change the import path of the page after determining the static of js and css.
When you are ready to deploy (release) your the app, you need only to publish the generated build artifacts - that is, the files in the `dist/browser` folder - to your cdn or static server. Note that the `index.html` is usually the entry page for your app and handles all missing file requests. You may need to change the import path of the page after determining the static of js and css.

The default static resource reference path directly points to the directory where the `dist` folder is published. For example, if you post `dist` to the root directory of the `ng-alain.com` site, the requested URL is `//ng-alain.com/***.js`, `//ng-alain.com/***.css`, if `dist` is posted to a directory under a certain directory, such as `v2`, request The URL is `//ng-alain.com/v2/***.js`, `//ng-alain.com/v2/***.css`.

If your static resource is deployed to another domain name (such as a separate CDN address), you can specify a CDN address with the `--deployUrl` parameter.
If your static resource is deployed to another domain name (such as a separate CDN address), you can specify a CDN address with the `--base-href` parameter.

```bash
ng build -deployUrl=//cdn.ng-alain.com/
ng build --base-href=https://cdn.ng-alain.com/
```

The generated `index.html` with its `*.js`, `*.css` files will automatically refer to `//cdn.ng-alain.com/*.js`, `//cdn.ng-alain.com/*css`, respectively.

### Routing strategy

Angular front-end routing has two different strategies: `HashLocationStrategy` and `PathLocationStrategy`. The former is routed by appending a `#` before a path, and the front-end routing management is performed by [HTML5 History](//developer.mozilla.org/en-US/docs/Web/API/History_API), while the latter is similar, but the path does not have `#` appended before it. Through the configuration of the server, the specified URL can be accessed to the current page, enabling front-end routing management.
Expand Down
10 changes: 3 additions & 7 deletions docs/deploy.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,14 @@ npm run analyze:view

## 发布

对于发布来讲,只需要将最终生成的静态文件,也就是通常情况下 `dist` 文件夹的静态文件发布到你的 cdn 或者静态服务器即可,需要注意的是其中的 `index.html` 通常会是你后台服务的入口页面,在确定了 js 和 css 的静态之后可能需要改变页面的引入路径。
对于发布来讲,只需要将最终生成的静态文件,也就是通常情况下 `dist/browser` 文件夹的静态文件发布到你的 cdn 或者静态服务器即可,需要注意的是其中的 `index.html` 通常会是你后台服务的入口页面,在确定了 js 和 css 的静态之后可能需要改变页面的引入路径。

默认的静态资源引用路径直接指向 `dist` 文件夹发布所处应用的目录下,例如你将 `dist` 发布至 `ng-alain.com` 站点的根目录里则请求的网址是 `//ng-alain.com/***.js``//ng-alain.com/***.css`,若 `dist` 发布至某站点下某个目录如 `v2` 文件夹下,则请求的网址是 `//ng-alain.com/v2/***.js``//ng-alain.com/v2/***.css`

如果你的静态资源是部署到其他域名(例如独立的 cdn 地址),你可以透过 `-d` 参数指定一个 cdn 地址。
如果你的静态资源是部署到其他域名(例如独立的 cdn 地址),你可以透过 `--base-href` 参数指定一个 cdn 地址。

```bash
ng build -d=//cdn.ng-alain.com/
ng build --base-href=https://cdn.ng-alain.com/
```

这样生成的 `index.html``*.js``*.css` 会自动加上 `//cdn.ng-alain.com/*.js`

### 路由策略

Angular 前端路由有两种不同策略 `HashLocationStrategy``PathLocationStrategy`。前者是以 `#` 后面的路径进行路由处理,通过 [HTML5 History](//developer.mozilla.org/en-US/docs/Web/API/History_API) 进行前端路由管理,而后者则是类似页面访问路径并没有 `#`,通过服务端的配置,能够访问指定 URL 都定向到当前页面,从而能够进行前端路由管理。
Expand Down

0 comments on commit 49a94c0

Please sign in to comment.