Skip to content

Commit 187046c

Browse files
authored
Merge branch 'master' into img-inline-doc
2 parents 8bf6e90 + cf2352f commit 187046c

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

docs/documentation/build.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ If a resource is less than 10kb it will also be inlined.
8989

9090
You'll see these resources be outputted and fingerprinted at the root of `dist/`.
9191

92+
### Service Worker
93+
94+
There is experimental service worker support for production builds available in the CLI.
95+
To enable it, run the following commands:
96+
```
97+
npm install @angular/service-worker --save
98+
ng set apps.0.serviceWorker=true
99+
```
100+
101+
On `--prod` builds a service worker manifest will be created and loaded automatically.
102+
Remember to disable the service worker while developing to avoid stale code.
103+
104+
Note: service worker support is experimental and subject to change.
105+
92106
## Options
93107
<details>
94108
<summary>aot</summary>

docs/documentation/stories.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@
2525
- [Code Coverage](stories/code-coverage)
2626
- [Application Environments](stories/application-environments)
2727
- [Autoprefixer Configuration](stories/autoprefixer)
28+
- [Deploy to GitHub Pages](stories/githug-pages)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Deploy to GitHub Pages
2+
3+
A simple way to deploy your Angular app is to use
4+
[GitHub Pages](https://help.github.com/articles/what-is-github-pages/).
5+
6+
The first step is to [create a GitHub account](https://github.com/join), and then
7+
[create a repository](https://help.github.com/articles/create-a-repo/) for your project.
8+
Make a note of the user name and project name in GitHub.
9+
10+
Then all you need to do is run `ng build --prod --output-path docs --base-href PROJECT_NAME`, where
11+
`PROJECT_NAME` is the name of your project in GitHub.
12+
Make a copy of `dist/index.html` and name it `dist/404.html`.
13+
14+
Commit your changes and push. On the GitHub project page, configure it to
15+
[publish from the docs folder](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/#publishing-your-github-pages-site-from-a-docs-folder-on-your-master-branch).
16+
17+
And that's all you need to do! Now you can see your page at
18+
`https://USER_NAME.github.io/PROJECT_NAME/`.
19+
20+
You can also use [angular-cli-ghpages](https://github.com/angular-buch/angular-cli-ghpages), a full
21+
featured package that does this all this for you and has extra functionality.

docs/documentation/stories/global-scripts.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,23 @@ You can also rename the output and lazy load it by using the object format:
2121
{ "input": "pre-rename-script.js", "output": "renamed-script" },
2222
],
2323
```
24+
25+
## Using global libraries inside your app
26+
27+
Once you import a library via the scripts array, you should **not** import it via a import statement
28+
in your TypeScript code (e.g. `import * as $ from 'jquery';`).
29+
If you do that, you'll end up with two different copies of the library: one imported as a
30+
global library, and one imported as a module.
31+
32+
This is especially bad for libraries with plugins, like JQuery, because each copy will have
33+
different plugins.
34+
35+
Instead, download typings for your library (`npm install @types/jquery`) which will give you
36+
access to the global variables exposed by that library.
37+
38+
If the global library you need to use does not have global typings, you can also declare them
39+
manually in `src/typings.d.ts` as `any`:
40+
41+
```
42+
declare var libraryName: any;
43+
```

0 commit comments

Comments
 (0)