Skip to content

Commit 05adeba

Browse files
committed
docs(cookbook-aot-compiler): ward's tweaks to angular#2790
1 parent 66ab573 commit 05adeba

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

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

+16-12
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ a#toh
343343

344344
***index.html***
345345

346-
The JiT and AoT apps are setup and launched so differently that they require their own `index.html` files.
346+
The JiT and AoT apps require their own `index.html` files because they setup and launch so differently.
347347
Here they are for comparison:
348348

349349
+makeTabs(
@@ -355,7 +355,8 @@ a#toh
355355
)
356356

357357
:marked
358-
They can't be in the same folder.
358+
They can't be in the same folder.
359+
359360
***Put the AoT version in the `/aot` folder***.
360361

361362
The JiT version relies on `SystemJS` to load individual modules and requires the `reflect-metadata` shim.
@@ -366,8 +367,8 @@ a#toh
366367

367368
***main.ts***
368369

369-
The JiT and AoT apps are also bootstraped differently that they require their own `main.ts` files.
370-
Here they are for comparison:
370+
JiT and AoT apps boot in much the same way but require different Angular libraries to do so.
371+
The differences are evident in these `main` files:
371372

372373
+makeTabs(
373374
`toh-6/ts/app/main-aot.ts,
@@ -378,17 +379,17 @@ a#toh
378379
)
379380

380381
:marked
381-
They can and should exist in the same folder.
382+
Both `main` files can and should exist in the same folder.
382383

383384
The `app/main-aot.ts` file is used by the AoT config scripts (`tsconfig-aot.json` and `rollup-config.js`).
384385

385-
Key differences are discussed in the [Bootstrap](#bootstrap) section, above.
386+
The [Bootstrap](#bootstrap) section, above covers the key differences.
386387

387-
*Component-relative Template URLS*
388+
***Component-relative Template URLS***
388389

389390
The AoT compiler requires that `@Component` URLS for external templates and css files be _component-relative_.
390-
That means that the value of `@Component.templateUrl` is a URL value relative to the component class file:
391-
`foo.component.html` no matter where `foo.component.ts` sits in the project folder structure.
391+
That means that the value of `@Component.templateUrl` is a URL value _relative_ to the component class file.
392+
The URL, `'foo.component.html'`, means that the template file is a sibling of its companion `foo.component.ts` file.
392393

393394
While JiT app URLs are more flexible, stick with _component-relative_ URLs for compatibility with AoT compilation.
394395

@@ -418,10 +419,13 @@ a#toh
418419

419420
.l-sub-section
420421
:marked
421-
_Note_ that the specific file structure of this project needs `typeRoots` to include `../../node_modules/@types/`,
422-
whereas in a typical setting it should include `node_modules/@types/` instead.
422+
The file structure of this specific sample project
423+
happens to place the `node_modules` two levels up from the project root.
424+
Therefore, `typeRoots` must be `../../node_modules/@types/`.
425+
In a more typical project, `node_modules` would be a sibling of tsconfig-aot.json`
426+
and `typeRoots` would be `node_modules/@types/`.
423427

424-
Make sure to edit accordingly to your project needs.
428+
Edit your `tsconfig-aot.json` to fit your project's file structure.
425429

426430
:marked
427431
### Tree Shaking

0 commit comments

Comments
 (0)