Add possibility of custom head scripts
This commit is contained in:
parent
e017e22582
commit
8cf973be70
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"scripts": [
|
||||||
|
]
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import routes from './routes'
|
||||||
import serialize from 'serialize-javascript'
|
import serialize from 'serialize-javascript'
|
||||||
import manifest from '../../public/static/manifest.json'
|
import manifest from '../../public/static/manifest.json'
|
||||||
import config from '../../config/config.json'
|
import config from '../../config/config.json'
|
||||||
|
import head from '../../config/head.json'
|
||||||
|
|
||||||
export function serverRender (req, res, next) {
|
export function serverRender (req, res, next) {
|
||||||
const activeRoute = routes.find((route) => matchPath(req.url, route)) || {}
|
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">
|
<link href=${manifest['bundle.css']} rel="stylesheet" rel="preload">
|
||||||
<!-- Initial Data -->
|
<!-- Initial Data -->
|
||||||
<script>window.__INITIAL_DATA__ = ${serialize(data)}</script>
|
<script>window.__INITIAL_DATA__ = ${serialize(data)}</script>
|
||||||
|
${head.scripts.join('\n')}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root">${html}</div>
|
<div id="root">${html}</div>
|
||||||
|
|
Loading…
Reference in New Issue