@@ -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+
8188a#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
218225code-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='.').
298306a#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
0 commit comments