Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// We're done, render the view
res.render('index', {
html,
head,
chunks,
chunk,
bodyClass,
aphrodite: css,
ie: req.get('user-agent').indexOf('MSIE') > -1,
});
return;
}
const context = createServerRenderContext();
({html, css} = StyleSheetServer.renderStatic( // https://github.com/Khan/aphrodite
() => renderToString( // https://react-router.now.sh/ServerRouter
{({action, location, router}) => }
)
));
const result = context.getResult();
if ( result.redirect ) {
res.redirect(302, result.redirect.pathname);
return;
}
function renderRedirect(redirectTo: string) {
const component = (
);
const {html, css} = StyleSheetServer.renderStatic(() =>
ReactDOMServer.renderToStaticMarkup(component)
);
const page = dedent`\
<title>${resolveTitleFromPath(routeData, path)}</title>
<style>${require("./index.css")}</style>
<style data-aphrodite="">${css.content}</style>
match({history, routes}, (error, redirectLocation, renderProps) => {
if (error) {
callback(error);
} else if (renderProps) {
const component = ;
const {html, css} = StyleSheetServer.renderStatic(() =>
ReactDOMServer.renderToString(component)
);
const page = dedent`\
<title>${resolveTitleFromPath(routeData, path)}</title>
<style>${require("./index.css")}</style>
<style data-aphrodite="">${css.content}</style>
aphrodite(component) {
debug('Running aphrodite.')
return StyleSheetServer.renderStatic(() =>
ReactDOMServer.renderToStaticMarkup(component)
)
}
export default ({ App, render }: PhenomicHtmlPropsType) => {
const {
html: { Main, State, Script },
css,
} = StyleSheetServer.renderStatic(() => render());
return (
<style data-aphrodite="{true}">{css.content}</style>
<main>
</main>