Closed HairyRabbit closed 6 years ago
Just a wild stab in the dark but "scripts" looks like something that would accept an array. Have you tried scripts=[vendor.js]
instead? Or however you specify arrays as a CLI argument string.
Yeap, [vendor.js]
also output split by char. I modifed the template like:
<% if (Array.isArray(htmlWebpackPlugin.options.scripts)) { %>
<% for (item of htmlWebpackPlugin.options.scripts) { %>
<% if (typeof item === 'string' || item instanceof String) { item = { src: item, type: 'text/javascript' } } %>
<script<% for (key in item) { %> <%= key %>="<%= item[key] %>"<% } %>></script>
<% } %>
<% } else { %>
<% for (item of htmlWebpackPlugin.options.scripts.split(';')) { %>
<% if (typeof item === 'string' || item instanceof String) { item = { src: item, type: 'text/javascript' } } %>
<script<% for (key in item) { %> <%= key %>="<%= item[key] %>"<% } %>></script>
<% } %>
<% } %>
It's supports simple multi scripts name read from cli args.
scripts=foo.js;bar.js
Any interest in adjustments here at this point?
I don't know if this is still broken or not. It's definitely a stagnant issue. If there is still interest here, please submit a PR, and we'll get it fixed for the cli case if needed.
When I use html-webpack-template with cli argumnet like:
It's will render follow script tags: