You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source files will be resolved, processed and auto-replaced with correct URLs in the generated HTML.
60
+
-**Resolves**[route URLs](#option-router) in `a.href`, useful for navigation in multi-pages.
60
61
-**Inlines**[JS](#recipe-inline-js), [CSS](#recipe-inline-css) and [Images](#recipe-inline-image) into HTML. See [how to inline all resources](#recipe-inline-all-assets-to-html) into single HTML file.
61
62
- Supports the [HMR for CSS](#option-css-hot) to update CSS in browser without a full reload.
62
63
- Watches for changes in the [data file](#option-entry-data) linked to the template in the plugin option.
@@ -175,6 +176,9 @@ See full list of all [plugin options](#toc-plugin-options).
175
176
176
177
[Open an example in StackBlitz](https://stackblitz.com/edit/hello-world-webpack?file=webpack.config.js)
177
178
179
+
> [!TIP]
180
+
> To resolve route URLs in `a.href` for navigation across multiple pages, you can enable the [router](#option-router) option.
181
+
178
182
---
179
183
> 🦖 **Mozilla** already uses this plugin to build static HTML files for the [Mozilla AI GUIDE](https://github.com/mozilla/ai-guide) site.
180
184
>
@@ -227,6 +231,7 @@ If you have discovered a bug or have a feature suggestion, feel free to create a
227
231
228
232
## 🔆 What's New in v4
229
233
234
+
-**NEW** added [router](#option-router) to resolve routes in `a.href`, useful for multi-pages (since `v4.18.0`).
230
235
-**NEW** you can include Markdown `*.md` files in your HTML template (since `v4.6.0`).
231
236
-**NEW** added supports the [HMR for CSS](#option-css-hot) (since `v4.5.0`).
232
237
-**NEW** added supports the [multiple configurations](https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations).
@@ -503,6 +508,8 @@ See [boilerplate](https://github.com/webdiscus/webpack-html-scss-boilerplate)
503
508
-[js](#option-js) (options for JS)
504
509
-[css](#option-css) (options for CSS)
505
510
-[data](#option-data) (🔗reference to [loaderOptions.data](#loader-option-data))
511
+
-[sources](#option-sources) (🔗reference to [loaderOptions.sources](#loader-option-sources))
512
+
-[router](#option-router) (enable resolving of route URLs in `a.href`)
506
513
-[beforePreprocessor](#option-before-preprocessor) (callback, 🔗reference to [loaderOptions.beforePreprocessor](#loader-option-before-preprocessor))
507
514
-[preprocessor](#option-preprocessor) (callback or string, 🔗reference to [loaderOptions.preprocessor](#loader-option-preprocessor))
508
515
-[preprocessorOptions](#option-preprocessor) (🔗reference to [loaderOptions.preprocessorOptions](#loader-option-preprocessorOptions))
@@ -2207,6 +2214,165 @@ Please see the details below under the [data](#loader-option-data) loader option
2207
2214
2208
2215
#### [↑ back to contents](#contents)
2209
2216
2217
+
<a id="option-sources" name="option-sources"></a>
2218
+
2219
+
### `sources`
2220
+
2221
+
Since the `v4.18.0`, the `sources` plugin option is the reference to [loaderOptions.sources](#loader-option-sources).
2222
+
2223
+
Now it is possible to define the `sources` option directly in the plugin options to simplify the config.
2224
+
2225
+
2226
+
The NEW syntactic "sugar":
2227
+
2228
+
```js
2229
+
newHtmlBundlerPlugin({
2230
+
entry: {
2231
+
index:'./src/views/home.ejs',
2232
+
},
2233
+
// new reference to the loaderOptions.sources
2234
+
sources: [...],
2235
+
}),
2236
+
```
2237
+
2238
+
The old syntax is still valid and will never be deprecated:
@@ -3260,6 +3426,10 @@ The default loader handles HTML files and `EJS`-like templates.
3260
3426
3261
3427
### `sources`
3262
3428
3429
+
> ℹ️ **Note**
3430
+
>
3431
+
> Since the `v4.18.0` is available new syntax, the [sources](#option-sources) option should be defined directly in the plugin option to simplify the config.
Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "html-bundler-webpack-plugin",
3
-
"version": "4.18.0-beta.2",
3
+
"version": "4.18.0",
4
4
"description": "Generates complete single-page or multi-page website from source assets. Build-in support for Markdown, Eta, EJS, Handlebars, Nunjucks, Pug. Alternative to html-webpack-plugin.",
0 commit comments