Skip to content

Commit bcbd37c

Browse files
committed
docs(@angular/cli): document serving the app from disk
Closes angular#4290
1 parent 3515c3b commit bcbd37c

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

docs/documentation/serve.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ All the build Options are available in serve below are the additional options.
2424

2525
`--ssl-cert` SSL certificate to use for serving HTTPS.
2626

27-
`--ssl-key` SSL key to use for serving HTTPS.
27+
`--ssl-key` SSL key to use for serving HTTPS.
28+
29+
## Note
30+
When running `ng serve`, the compiled output is served from memory, not from disk. This means that the application being served is not located on disk in the `dist` folder.

docs/documentation/stories.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
- [Routing](stories/routing)
2121
- [3rd Party Lib](stories/third-party-lib)
2222
- [Corporate Proxy](stories/using-corporate-proxy)
23+
- [Serve from Disk](stories/disk-serve)
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Serving from Disk
2+
3+
The CLI supports running a live reload experience to users by running `ng serve`. This will compile the application upon file saves and reload the browser with the newly compiled application. This is done by hosting the application in memory and serving it via [webpack-dev-server](https://webpack.js.org/guides/development/#webpack-dev-server).
4+
5+
If you wish to get a similar experience with the application output to disk please use the steps below.
6+
7+
## Environment Setup
8+
### Install a web server
9+
Because you will not be using webpack-dev-server you will need to install a web server for the browser to request the application. There are many to choose from but a good one to try is [live-server](https://www.npmjs.com/package/live-server) as it will auto-reload your browser when new files are outputed.
10+
11+
## Usage
12+
In order to mimic the live-reload you get with `ng serve` by default you will need to open two terminals. The first will run the build in a watch mode to compile the application to the `dist` folder. The second will run the web server against the dist folder. The combination of these two processes will mimic the same behavior of `ng serve`.
13+
### 1st terminal - Start the build
14+
```bash
15+
ng build --watch
16+
```
17+
### 2nd terminal - Start the web server
18+
```bash
19+
live-server dist
20+
```
21+
22+
### Open browser
23+
Navigate to the URL the web server uses. (The default URL for live-server is `http://127.0.0.1:8080`)

0 commit comments

Comments
 (0)