This repository has been archived by the owner on Mar 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ejs
107 lines (107 loc) · 3.85 KB
/
index.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!doctype html>
<html lang="en" class=""
<% if (htmlWebpackPlugin.files.manifest) { %>
manifest="<%= htmlWebpackPlugin.files.manifest %>"
<% } %>
>
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<% if (htmlWebpackPlugin.options.mobile) { %>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<% } %>
<% if (htmlWebpackPlugin.options.meta) { %>
<% for (let key in htmlWebpackPlugin.options.meta) { %>
<meta name="<%= key %>" content="<%= htmlWebpackPlugin.options.meta[key] %>" />
<% } %>
<% } %>
<title><%= htmlWebpackPlugin.options.title || 'App' %></title>
<% if (htmlWebpackPlugin.files.favicon) { %>
<link rel="shortcut icon" href="<%= htmlWebpackPlugin.files.favicon %>" />
<% } %>
<% if (htmlWebpackPlugin.options.links) { %>
<% for(let link of htmlWebpackPlugin.options.links) { %>
<% if (link !== null && typeof link === 'object' ) { %>
<link
<% for (let key in link) { %>
<%= key %>="<%= link[key] %>"
<% } %>
>
<% } else { %>
<link href="<%= link %>" rel="stylesheet" />
<% } %>
<% } %>
<% } %>
<% for (let css in htmlWebpackPlugin.files.css) { %>
<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet" />
<% } %>
<% if (htmlWebpackPlugin.options.baseHref) { %>
<base href="<%= htmlWebpackPlugin.options.baseHref %>" />
<% } %>
</head>
<body>
<% if (htmlWebpackPlugin.options.unsupportedBrowser) { %>
<!--[if lte IE 9]>
<div class="unsupported-browser">
Sorry, your browser is not supported. Please upgrade to
the latest version or switch your browser to use this site.
See <a href="http://outdatedbrowser.com/">outdatedbrowser.com</a>
for options.
</div>
<![endif]-->
<% } %>
<% if (htmlWebpackPlugin.options.appMountId) { %>
<div id="<%= htmlWebpackPlugin.options.appMountId %>"></div>
<% } %>
<% if (htmlWebpackPlugin.options.appMountIds && htmlWebpackPlugin.options.appMountIds.length > 0) { %>
<% for (let index in htmlWebpackPlugin.options.appMountIds) { %>
<div id="<%= htmlWebpackPlugin.options.appMountIds[index] %>"></div>
<% } %>
<% } %>
<% if (htmlWebpackPlugin.options.window) { %>
<script>
<% for (let varName in htmlWebpackPlugin.options.window) { %>
window['<%= varName %>'] = <%= JSON.stringify(htmlWebpackPlugin.options.window[varName]) %>;
<% } %>
</script>
<% } %>
<% if (htmlWebpackPlugin.options.scripts) { %>
<% for (let script of htmlWebpackPlugin.options.scripts) { %>
<script
<% if (script.src) { %>src="<%= script.src %>"<% } %>
<% if (script.crossorigin) { %>crossorigin="<%= script.crossorigin %>"<% } %>
>
<% if (script.body) { %><%= script.body %><% } %>
</script>
<% } %>
<% } %>
<% if (htmlWebpackPlugin.files.chunks) { %>
<% for (let chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
<% } %>
<% } %>
<% if (htmlWebpackPlugin.options.googleAnalytics) { %>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
<% if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
ga('create', '<%= htmlWebpackPlugin.options.googleAnalytics.trackingId %>', 'auto');
<% } else {
throw new Error("html-webpack-template requires googleAnalytics.trackingId config");
} %>
<% if (htmlWebpackPlugin.options.googleAnalytics.pageViewOnLoad) { %>
ga('send', 'pageview');
<% } %>
</script>
<% } %>
</body>
</html>