Add possibility of custom head scripts

This commit is contained in:
LordMathis 2019-10-13 13:49:30 +02:00
parent e017e22582
commit 8cf973be70
No known key found for this signature in database
GPG Key ID: 575849FD91CE470C
2 changed files with 6 additions and 0 deletions

4
config/head.json Normal file
View File

@ -0,0 +1,4 @@
{
"scripts": [
]
}

View File

@ -6,6 +6,7 @@ import routes from './routes'
import serialize from 'serialize-javascript'
import manifest from '../../public/static/manifest.json'
import config from '../../config/config.json'
import head from '../../config/head.json'
export function serverRender (req, res, next) {
const activeRoute = routes.find((route) => matchPath(req.url, route)) || {}
@ -39,6 +40,7 @@ function renderFullPage (html, data) {
<link href=${manifest['bundle.css']} rel="stylesheet" rel="preload">
<!-- Initial Data -->
<script>window.__INITIAL_DATA__ = ${serialize(data)}</script>
${head.scripts.join('\n')}
</head>
<body>
<div id="root">${html}</div>