-
Notifications
You must be signed in to change notification settings - Fork 4
/
html.ts
33 lines (33 loc) · 845 Bytes
/
html.ts
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
export default (opts) => `<html>
<head>
<title>${opts.manifest.bundleId}</title>
<style>
body {
background: #282827;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<script>
try {
if (window.cep_node) {
window.nodeRequire = function (path) {
if (path.substr(0, 1) === '.') {
return cep_node.require(__dirname + path.substr(1))
} else {
return cep_node.require(path)
}
}
} else {
window.nodeRequire = require
}
} catch (err) {
console.log(err)
}
</script>
${opts.compilers && opts.compilers.cep ? opts.compilers.cep.map((src, i) =>
`<script src="${opts.live ? `http://localhost:${opts.devPort + i}/index.js` : `./${src}/index.js`}"></script>`) : ''}
</body>
</html>`