|
16 | 16 | ## HTML template as entry point |
17 | 17 |
|
18 | 18 | The **HTML Bundler** generates static HTML or [template function](#template-in-js) from [various templates](#template-engine) containing source files of scripts, styles, images, fonts and other resources, similar to how it works in [Vite](https://vitejs.dev/guide/#index-html-and-project-root). |
19 | | -This plugin allows using a template file as an [entry point](#option-entry). |
| 19 | +This plugin looks at the template files in [entry](#option-entry) to start building the bundle. |
| 20 | +The source files of dependencies (scripts, styles, etc.) can be defined directly in the template. |
20 | 21 |
|
21 | 22 | The plugin resolves source files of assets in templates and replaces them with correct output URLs in the generated HTML. |
22 | 23 | The resolved assets will be processed via Webpack plugins/loaders and placed into the output directory. |
23 | 24 | You can use a relative path or Webpack alias to a source file. |
24 | 25 |
|
25 | 26 | A template imported in JS will be compiled into [template function](#template-in-js). You can use the **template function** in JS to render the template with variables in runtime on the client-side in the browser. |
26 | 27 |
|
27 | | - |
28 | 28 | This plugin is an **advanced replacement** of `html-webpack-plugin` and many other [plugins and loaders](#list-of-plugins). |
29 | 29 |
|
30 | 30 | <!-- |
@@ -169,6 +169,10 @@ Thank you to all our sponsors and patrons! |
169 | 169 | <img src="https://c10.patreonusercontent.com/4/patreon-media/p/user/43568167/0ef77126597d460c9505bdd0aea2eea9/eyJ3IjoyMDB9/1.png?token-time=2145916800&token-hash=7izh1FZTToAqf4Qks3Qrk8YcNbGymF-sBi0hkK_aJO8%3D" width="50" title="Raymond Ackloo" alt="patron" style="max-width: 100%;"> |
170 | 170 | <p>Raymond<br>Ackloo</p> |
171 | 171 | </a></td> |
| 172 | + <td style="border: 0"><a href="https://github.com/chkpnt"> |
| 173 | + <img src="https://avatars.githubusercontent.com/u/1956979?s=50&v=4" width="50" title="Gregor Dschung" alt="Gregor Dschung" style="max-width: 100%;"> |
| 174 | + <p>Gregor<br>Dschung</p> |
| 175 | + </a></td> |
172 | 176 | </tr> |
173 | 177 | </table> |
174 | 178 |
|
@@ -3502,6 +3506,12 @@ Include the partials in the `src/views/page/home.html` template with the `includ |
3502 | 3506 |
|
3503 | 3507 | The `include` helper automatically resolves `.html` and `.hbs` extensions, it can be omitted. |
3504 | 3508 |
|
| 3509 | +**The `runtime` option** |
| 3510 | +
|
| 3511 | +The path to the handlebars runtime library. The path can be absolute or relative to `node_modules` directory. |
| 3512 | +Defaults runtime file is `handlebars/runtime`. |
| 3513 | +This options is used only by import templates in JavaScript, in [compile mode](#compile-mode). |
| 3514 | +
|
3505 | 3515 | **The `partials` option** |
3506 | 3516 |
|
3507 | 3517 | Type: `Array<string>|Object` Default: `[]` |
@@ -4476,6 +4486,8 @@ _./partials/star-button.html_ |
4476 | 4486 | </button> |
4477 | 4487 | ``` |
4478 | 4488 |
|
| 4489 | +<a id="compile-mode" name="compile-mode"></a> |
| 4490 | + |
4479 | 4491 | ### Compile mode |
4480 | 4492 |
|
4481 | 4493 | The `compile` is the default mode for the template imported in JavaScript file. |
@@ -4521,7 +4533,7 @@ _./partials/people.ejs_ |
4521 | 4533 | `include` is supported |
4522 | 4534 | - [ejs](#loader-option-preprocessor-options-ejs) - generates a fast smallest pure template function w/o runtime (**recommended** for use on client-side)\ |
4523 | 4535 | `include` is supported |
4524 | | -- [handlebars](#loader-option-preprocessor-options-handlebars) - generates a precompiled template with runtime (~28KB)\ |
| 4536 | +- [handlebars](#loader-option-preprocessor-options-handlebars) - generates a precompiled template with runtime (~18KB)\ |
4525 | 4537 | `include` is NOT supported (yet) |
4526 | 4538 | - [nunjucks](#loader-option-preprocessor-options-nunjucks) - generates a precompiled template with runtime (~41KB)\ |
4527 | 4539 | `include` is supported |
|
0 commit comments