Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 7c2ef49

Browse files
thelgevoldwardbell
authored andcommitted
docs(toh-6-aot): add aot to toh-6
1 parent cff8876 commit 7c2ef49

File tree

7 files changed

+30
-25
lines changed

7 files changed

+30
-25
lines changed

public/docs/_examples/_boilerplate/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
},
1414
"exclude": [
1515
"node_modules/*",
16-
"*.-aot.ts"
16+
"**/*-aot.ts"
1717
]
1818
}

public/docs/_examples/cb-aot-compiler/ts/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ export class AppComponent {
1313
toggleHeading() {
1414
this.showHeading = !this.showHeading;
1515
}
16-
1716
}

public/docs/_examples/cb-aot-compiler/ts/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
<script src="node_modules/core-js/client/shim.min.js"></script>
1111
<script src="node_modules/zone.js/dist/zone.js"></script>
12-
<script src="node_modules/reflect-metadata/Reflect.js"></script>
1312

1413
</head>
1514

public/docs/_examples/toh-6-aot/ts/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
<base href="/">
66
<title>Angular Tour of Heroes</title>
77
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
98
<link rel="stylesheet" href="styles.css">
109

1110
<script src="node_modules/core-js/client/shim.min.js"></script>
12-
1311
<script src="node_modules/zone.js/dist/zone.js"></script>
14-
1512
<!-- #docregion moduleId -->
1613
<script>window.module = 'aot';</script>
1714
<!-- #enddocregion moduleId -->

public/docs/_examples/tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,5 @@
2020
],
2121
"include": [
2222
"*/e2e-spec.ts"
23-
],
24-
"exclude": [
25-
"**/node_modules/*",
26-
"*.-aot.ts"
2723
]
2824
}

public/docs/ts/latest/cookbook/aot-compiler.jade

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,21 @@ a#aot-jit
7878
The AoT compiler detects and reports template binding errors during the build step
7979
before users can see them.
8080

81+
82+
*Better security*
83+
84+
AoT compiles HTML templates and components into JavaScript files long before they are served to the client.
85+
With no templates to read and no risky client-side HTML or JavaScript evaluation,
86+
there are fewer opportunities for injection attacks.
87+
8188
a#compile
8289
.l-main-section
8390
:marked
8491
## Compile with AoT
8592

8693
### Prepare for offline compilation
8794

88-
This cookbook takes the <a href='/docs/ts/latest/quickstart.html'>QuickStart</a> as its starting point.
95+
Take the <a href='/docs/ts/latest/quickstart.html'>QuickStart</a> as a starting point.
8996
A few minor changes to the lone `app.component` lead to these two class and html files:
9097

9198
+makeTabs(
@@ -94,7 +101,7 @@ a#compile
94101
null,
95102
`app/app.component.html,
96103
app/app.component.ts`
97-
)
104+
)(format='.')
98105

99106
:marked
100107
Install a few new npm dependencies with the following command:
@@ -218,8 +225,9 @@ a#tree-shaking
218225
code-example(format='.').
219226
npm install rollup rollup-plugin-node-resolve rollup-plugin-commonjs rollup-plugin-uglify --save-dev
220227
:marked
221-
Next, create a configuration file to tell Rollup how to process the application.
222-
The configuration file in this cookbook is named `rollup-config.js` and looks like this.
228+
Next, create a configuration file (`rollup-config.js`)
229+
in the project root directory to tell Rollup how to process the application.
230+
The cookbook configuration file looks like this.
223231

224232
+makeExample('cb-aot-compiler/ts/rollup-config.js', null, 'rollup-config.js')(format='.')
225233
:marked
@@ -298,9 +306,9 @@ code-example(format='.').
298306
a#source-code
299307
.l-main-section
300308
:marked
301-
## Source Code
309+
## AoT QuickStart Source Code
302310

303-
Here is the pertinent AoT source code for this cookbook so far:
311+
Here's the pertinent source code:
304312
+makeTabs(
305313
`cb-aot-compiler/ts/app/app.component.html,
306314
cb-aot-compiler/ts/app/app.component.ts,
@@ -341,16 +349,16 @@ a#toh
341349
Both scripts appear in its `index.html`.
342350

343351
The AoT version loads the entire application in a single script, `dist/build.js`.
344-
It has no need for the `SystemJS` or `reflect-metadata` shim whose scripts are absent from its `index.html`
352+
It does not need `SystemJS` or the `reflect-metadata` shim; those scripts are absent from its `index.html`
345353

346354
Here are the two index.html files for comparison:
347355

348356
+makeTabs(
349-
`toh-6/ts/index.html,
350-
toh-6-aot/ts/index.html`,
357+
`toh-6-aot/ts/index.html,
358+
toh-6/ts/index.html`,
351359
null,
352-
`index.html (JiT),
353-
index.html (AoT)`
360+
`index.html (AoT),
361+
index.html (JiT)`
354362
)
355363

356364
:marked
@@ -379,11 +387,11 @@ a#toh
379387
You'll need separate TypeScript configuration files such as these:
380388

381389
+makeTabs(
382-
`toh-6/ts/tsconfig.json,
383-
toh-6/ts/tsconfig-aot.json`,
390+
`toh-6/ts/tsconfig-aot.json,
391+
toh-6/ts/tsconfig.json`,
384392
null,
385-
`tsconfig.json (JiT),
386-
tsconfig-aot.json (AoT)`
393+
`tsconfig.json (AoT),
394+
tsconfig-aot.json (JiT)`
387395
)
388396

389397
:marked

public/docs/ts/latest/guide/change-log.jade

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ block includes
77
The Angular documentation is a living document with continuous improvements.
88
This log calls attention to recent significant changes.
99

10+
## NEW "Ahead of Time (AoT) Compilation" cookbook (2016-10-11)
11+
The NEW [Ahead of Time (AoT) Compilation](../cookbook/aot-compiler.html) cookbook
12+
explains what AoT compilation is and why you'd want it.
13+
It demonstrates the basics with a QuickStart app
14+
followed by the more advanced considerations of compiling and bundling the Tour of Heroes.
15+
1016
## Sync with Angular v.2.0.2 (2016-10-6)
1117
Docs and code samples updated and tested with Angular v.2.0.2
1218

0 commit comments

Comments
 (0)