| 30 | * @param head - optional arguments to be placed into the head |
| 31 | */ |
| 32 | function renderFullPage(renderedContent, initialState, head={ |
| 33 | title: 'React Webpack Node', |
| 34 | meta: '<meta name="viewport" content="width=device-width, initial-scale=1" />', |
| 35 | link: '<link rel="stylesheet" href="/assets/styles/main.css"/>' |
| 36 | }) { |
| 37 | return ` |
| 38 | <!doctype html> |
| 39 | <html lang=""> |
| 40 | |
| 41 | <head> |
| 42 | ${head.title} |
| 43 | |
| 44 | ${head.meta} |
| 45 | |
| 46 | ${head.link} |
| 47 | </head> |
| 48 | <body> |
| 49 | <div id="app">${renderedContent}</div> |
| 50 | |
| 51 | <script> |
| 52 | window.__INITIAL_STATE__ = ${JSON.stringify(initialState)}; |
| 53 | </script> |
| 54 | <script type="text/javascript" charset="utf-8" src="/assets/app.js"></script> |
| 55 | </body> |
| 56 | </html> |
| 57 | |
| 58 | `; |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * Export render function to be used in server/config/routes.js |