Skip to content
This repository was archived by the owner on May 8, 2018. It is now read-only.

Commit 8927bc9

Browse files
committed
feat(server): add basic html template
feat(server): add basic html template
1 parent 41112dd commit 8927bc9

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/server/ssr/Html.jsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const IndexHTMLComponent = ({App, assets}) => {
2+
const createBody = () => {
3+
const html = `
4+
<div id="app">${App}</div>
5+
${Object.keys(assets)
6+
.filter(bundleName => assets[bundleName].js)
7+
.map(bundleName => {
8+
const path = assets[bundleName].js
9+
return `<script src="${path}" type="text/javascript"></script>`
10+
})
11+
.join('')}`
12+
return html
13+
}
14+
15+
const createHead = () => {
16+
const html = `
17+
<meta charset="utf-8" />
18+
<title>Tiny-universal-skeleton</title>
19+
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
20+
<meta
21+
name="description"
22+
content="Tiny universal skeleton"
23+
/>
24+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
25+
<base href="/" />
26+
<meta name="msapplication-tap-highlight" content="no" />`
27+
return html
28+
}
29+
30+
return `<html>
31+
<head>${createHead()}<head>
32+
<body>
33+
${createBody()}
34+
</body>
35+
</html>`
36+
}
37+
38+
export default IndexHTMLComponent

0 commit comments

Comments
 (0)