Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Created June 4, 2018 17:07
Show Gist options
  • Save SaraVieira/78c0fab142c630f3ec32ec2bb58d43fb to your computer and use it in GitHub Desktop.
Save SaraVieira/78c0fab142c630f3ec32ec2bb58d43fb to your computer and use it in GitHub Desktop.
...
import { Helmet } from 'react-helmet'
....
const helmet = Helmet.renderStatic()
res.send(`<!doctype html>
<html lang="en" ${helmet.htmlAttributes.toString()}>
<head>
${helmet.title.toString()}
${helmet.meta.toString()}
${helmet.link.toString()}
${assets.client.css
? `<link rel="stylesheet" href="${assets.client.css}">`
: '' }
${process.env.NODE_ENV === 'production'
? `<script src="${assets.client.js}" defer></script>`
: `<script src="${assets.client.js}" defer crossorigin></script>`}
<style>${fontawesome.dom.css()}</style>
</head>
<body ${helmet.bodyAttributes.toString()}>
<div id="root">${markup}</div>
</body>
</html>`
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment