My Webpack4 configuration almost works, but there is still one problem I can't figure out how to solve.
This is the webpack configuration:
new HtmlWebpackPlugin({
template: './resources/head-template.tpl',
filename: './templates/head.tpl',
hash: true,
chunks : ['site'],
inject: false,
alwaysWriteToDisk: true,
}),
My template goes more or less like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
(... more code...)
<% for (var css in htmlWebpackPlugin.files.css) { %>
<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
<% } %>
(... more code...)
</head>
<!-- no /html here!!!-->
There is no </html>
tag in my template file.
However, the final generated head.tpl DOES have a closing </html>
. That file is meant to be embedded, so it should not have that tag.
Can I solve this somehow?
If it's embedded, could you remove the upper <html>
tag too (as I assume that would be on the host page already), then it shouldn't auto close the tag.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments