File: readme.md

package info (click to toggle)
node-html-webpack-plugin 5.5.3%2Brepack2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,980 kB
  • sloc: javascript: 16,057; makefile: 16; sh: 6
file content (24 lines) | stat: -rw-r--r-- 736 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# custom insertion example

This example shows how you can define the position where the scripts are injected
by setting `inject:false` and using the template parameters inside the `index.ejs`

The example is using the template parameters `headTags` and `bodyTags`

```
<%= htmlWebpackPlugin.tags.headTags %>
<%= htmlWebpackPlugin.tags.bodyTags %>
```

`headTags` and `bodyTags` are arrays so you can use any Array.prototype function like `filter`:

```
<%= htmlWebpackPlugin
  .tags
  .headTags
  .filter((tag) => tag.tagName === 'meta')
  .join('') 
%>
```

For further information about the tag object take a look at the `createHtmlTagObject` inside `lib/html-tags.js` or at the `prepareAssetTagGroupForRendering` inside `index.js`.