Skip to content

Commit ec081fc

Browse files
committed
feat(compile): Update template to be compatible with html-webpack-plugin@2
BREAKING CHANGE: is now an underscore template
1 parent c14bee6 commit ec081fc

File tree

2 files changed

+45
-42
lines changed

2 files changed

+45
-42
lines changed

index.html

+42-42
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
11
<!DOCTYPE html>
2-
<!--[if lt IE 7 ]> <html lang="en" class="ie6" {% if(o.htmlWebpackPlugin.files.manifest) { %} manifest="{%= o.htmlWebpackPlugin.files.manifest %}"{% } %}> <![endif]-->
3-
<!--[if IE 7 ]> <html lang="en" class="ie7" {% if(o.htmlWebpackPlugin.files.manifest) { %} manifest="{%= o.htmlWebpackPlugin.files.manifest %}"{% } %}> <![endif]-->
4-
<!--[if IE 8 ]> <html lang="en" class="ie8" {% if(o.htmlWebpackPlugin.files.manifest) { %} manifest="{%= o.htmlWebpackPlugin.files.manifest %}"{% } %}> <![endif]-->
5-
<!--[if IE 9 ]> <html lang="en" class="ie9" {% if(o.htmlWebpackPlugin.files.manifest) { %} manifest="{%= o.htmlWebpackPlugin.files.manifest %}"{% } %}> <![endif]-->
6-
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="" {% if(o.htmlWebpackPlugin.files.manifest) { %} manifest="{%= o.htmlWebpackPlugin.files.manifest %}"{% } %}> <!--<![endif]-->
2+
<!--[if lt IE 7 ]> <html lang="en" class="ie6" <% if(htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
3+
<!--[if IE 7 ]> <html lang="en" class="ie7" <% if(htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
4+
<!--[if IE 8 ]> <html lang="en" class="ie8" <% if(htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
5+
<!--[if IE 9 ]> <html lang="en" class="ie9" <% if(htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
6+
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="" <% if(htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <!--<![endif]-->
77
<head>
88
<meta charset="utf-8">
9-
<title>{%=o.htmlWebpackPlugin.options.title || 'Webpack App'%}</title>
9+
<title><%= htmlWebpackPlugin.options.title || 'Webpack App'%></title>
1010

11-
{% if (o.htmlWebpackPlugin.files.favicon) { %}
12-
<link rel="shortcut icon" href="{%=o.htmlWebpackPlugin.files.favicon%}">
13-
{% } %}
14-
{% if (o.htmlWebpackPlugin.options.mobile) { %}
11+
<% if (htmlWebpackPlugin.files.favicon) { %>
12+
<link rel="shortcut icon" href="<%= htmlWebpackPlugin.files.favicon%>">
13+
<% } %>
14+
<% if (htmlWebpackPlugin.options.mobile) { %>
1515
<meta name="viewport" content="width=device-width, initial-scale=1">
16-
{% } %}
16+
<% } %>
1717

18-
{% for (var css in o.htmlWebpackPlugin.files.css) { %}
19-
<link href="{%=o.htmlWebpackPlugin.files.css[css] %}" rel="stylesheet">
20-
{% } %}
18+
<% for (var css in htmlWebpackPlugin.files.css) { %>
19+
<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
20+
<% } %>
2121
</head>
2222
<body>
23-
{% if (o.htmlWebpackPlugin.options.unsupportedBrowser) { %}
23+
<% if (htmlWebpackPlugin.options.unsupportedBrowser) { %>
2424
<style>.unsupported-browser { display: none; }</style>
2525
<div class="unsupported-browser">
2626
Sorry, your browser is not supported. Please upgrade to
2727
the latest version or switch your browser to use this site.
2828
See <a href="http://outdatedbrowser.com/">outdatedbrowser.com</a>
2929
for options.
3030
</div>
31-
{% } %}
31+
<% } %>
3232

33-
{% if (o.htmlWebpackPlugin.options.appMountId) { %}
34-
<div id="{%=o.htmlWebpackPlugin.options.appMountId%}"></div>
35-
{% } %}
33+
<% if (htmlWebpackPlugin.options.appMountId) { %>
34+
<div id="<%= htmlWebpackPlugin.options.appMountId%>"></div>
35+
<% } %>
3636

37-
{% if (o.htmlWebpackPlugin.options.appMountIds && o.htmlWebpackPlugin.options.appMountIds.length > 0) { %}
38-
{% for (var index in o.htmlWebpackPlugin.options.appMountIds) { %}
39-
<div id="{%=o.htmlWebpackPlugin.options.appMountIds[index]%}"></div>
40-
{% } %}
41-
{% } %}
37+
<% if (htmlWebpackPlugin.options.appMountIds && htmlWebpackPlugin.options.appMountIds.length > 0) { %>
38+
<% for (var index in htmlWebpackPlugin.options.appMountIds) { %>
39+
<div id="<%= htmlWebpackPlugin.options.appMountIds[index]%>"></div>
40+
<% } %>
41+
<% } %>
4242

43-
{% if (o.htmlWebpackPlugin.options.window) { %}
43+
<% if (htmlWebpackPlugin.options.window) { %>
4444
<script>
45-
{% for (var varName in o.htmlWebpackPlugin.options.window) { %}
46-
window['{%=varName%}'] = {%#JSON.stringify(o.htmlWebpackPlugin.options.window[varName])%};
47-
{% } %}
45+
<% for (var varName in htmlWebpackPlugin.options.window) { %>
46+
window['<%=varName%>'] = <%= JSON.stringify(htmlWebpackPlugin.options.window[varName]) %>;
47+
<% } %>
4848
</script>
49-
{% } %}
49+
<% } %>
5050

51-
{% for (var chunk in o.htmlWebpackPlugin.files.chunks) { %}
52-
<script src="{%=o.htmlWebpackPlugin.files.chunks[chunk].entry %}"></script>
53-
{% } %}
51+
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
52+
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
53+
<% } %>
5454

55-
{% if (o.htmlWebpackPlugin.options.devServer) { %}
56-
<script src="{%=o.htmlWebpackPlugin.options.devServer%}/webpack-dev-server.js"></script>
57-
{% } %}
55+
<% if (htmlWebpackPlugin.options.devServer) { %>
56+
<script src="<%= htmlWebpackPlugin.options.devServer%>/webpack-dev-server.js"></script>
57+
<% } %>
5858

59-
{% if (o.htmlWebpackPlugin.options.googleAnalytics) { %}
59+
<% if (htmlWebpackPlugin.options.googleAnalytics) { %>
6060
<script>
6161
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
6262
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
6363
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6464
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
6565

6666

67-
{% if (o.htmlWebpackPlugin.options.googleAnalytics.trackingId) { %}
68-
ga('create', '{%=o.htmlWebpackPlugin.options.googleAnalytics.trackingId%}', 'auto');
69-
{% } else { throw new Error("html-webpack-template requires googleAnalytics.trackingId config"); }%}
67+
<% if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
68+
ga('create', '<%= htmlWebpackPlugin.options.googleAnalytics.trackingId%>', 'auto');
69+
<% } else { throw new Error("html-webpack-template requires googleAnalytics.trackingId config"); }%>
7070

71-
{% if (o.htmlWebpackPlugin.options.googleAnalytics.pageViewOnLoad) { %}
71+
<% if (htmlWebpackPlugin.options.googleAnalytics.pageViewOnLoad) { %>
7272
ga('send', 'pageview');
73-
{% } %}
73+
<% } %>
7474
</script>
75-
{% } %}
75+
<% } %>
7676
</body>
7777
</html>

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,8 @@
3232
"commitizen": "^2.4.6",
3333
"cz-conventional-changelog": "^1.1.5",
3434
"semantic-release": "^4.3.5"
35+
},
36+
"peerDependencies": {
37+
"html-webpack-plugin": "2.x"
3538
}
3639
}

0 commit comments

Comments
 (0)