docs(component-relative): tweak webpack explanation

closes #2157
Fixes #2156
This commit is contained in:
Jesús Rodríguez 2016-08-21 14:03:58 +02:00 committed by Ward Bell
parent 128915d6c3
commit 9ec4cbf3a4
2 changed files with 12 additions and 5 deletions

View File

@ -69,7 +69,7 @@ include ../_util-fns
.alert.is-helpful
:marked
Webpack users may prefer [an alternative approach](#webpack) that uses `require`.
Webpack users may prefer [an alternative approach](#webpack).
.l-main-section
:marked
@ -129,12 +129,18 @@ a#why-default
a#webpack
.l-main-section
:marked
## Webpack: load templates and styles with *require*
## Webpack: load templates and styles
Webpack developers have an alternative to `moduleId`.
They can load templates and styles at runtime by setting the component metadata `template` and `style` properties
with `require` statements that reference *component-relative* URLS.
They can load templates and styles at runtime by adding `./` at the beginning of the `template` and `styles` / `styleUrls`
properties that reference *component-relative URLS.
+makeExample('webpack/ts/src/app/app.component.ts')(format='.')
.l-sub-section
:marked
Webpack will do a `require` behind the scenes to load the templates and styles. Read more [here](../guide/webpack.html#highlights).
:marked
See the [Introduction to Webpack](../guide/webpack.html).

View File

@ -441,6 +441,7 @@ p.
`src/vendor.ts,
src/polyfills.ts`
)
<a id="highlights"></a>
:marked
### Highlights: