Transmit.renderToString(StyleProvider, renderProps).then(({reactString, reactData}) => { let cssModules = ""; Object.keys(styles).forEach((style) => { cssModules += styles[style]; }); let template = ( `<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8" /> <title>react-isomorphic-starterkit</title> <link rel="shortcut icon" href="${favicon}" /> <style>${cssModules}</style> </head> <body> <div id="react-root">${reactString}</div> </body> </html>` ); this.type = "text/html"; this.body = Transmit.injectIntoMarkup(template, reactData, [`${webserver}/dist/client.js`]); callback(null); }).catch(e => {
Transmit.renderToString(ReactRouter.RouterContext, renderProps).then(({reactString, reactData}) => { let head = Helmet.rewind(); let template = ( `<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> ${head.title.toString()} ${head.meta.toString()} ${head.link.toString()} ${styleTag} </head> <body itemScope itemType="http://schema.org/WebPage"> <div id="react-root">${reactString}</div> </body> </html>` ); this.type = "text/html"; this.body = Transmit.injectIntoMarkup(template, reactData, [`${webserver}/dist/client.js`]); callback(null); });
fs.readFile('./index.html', 'utf8', function (err, file) { if (err) { return console.log(err); } const document = file.replace(/<div id="app"><\/div>/, `<div id="app">${reactString}</div>`); const output = Transmit.injectIntoMarkup(document, reactData, ['/built/client.js']); res.send(output); });
Transmit.renderToString(Root).then(({reactString, reactData}) => { const template = ( `<!doctype html> <html lang='en-us'> <head> <meta charset='utf-8' /> <title>Neos React Rendering</title> </head> <body> <div id='react-root'>${reactString}</div> </body> </html>` ); this.type = 'text/html'; this.body = Transmit.injectIntoMarkup(template, reactData); callback(null); }).catch(e => {
).then(({reactString, reactData}) => { let output = ( `<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <title>react-isomorphic-starterkit</title> <link rel="shortcut icon" href="/favicon.ico"> </head> <body> <div id="react-root">${reactString}</div> </body> </html>` ); const webserver = process.env.NODE_ENV === "production" ? "" : "//localhost:8080"; output = Transmit.injectIntoMarkup(output, reactData, [`${webserver}/dist/client.js`]); reply(output); }).catch((error) => {
Transmit.renderToString(RoutingContext, renderProps).then(({reactString, reactData}) => { let template = ( `<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <title>react-isomorphic-starterkit</title> <link rel="shortcut icon" href="/favicon.ico"> </head> <body> <div id="react-root">${reactString}</div> </body> </html>` ); this.type = "text/html"; this.body = Transmit.injectIntoMarkup(template, reactData, [`${webserver}/dist/client.js`]); callback(null); });
Transmit.renderToString(ReactRouter.RoutingContext, renderProps).then(({reactString, reactData}) => { let template = ( `<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1"> <title>Scott is… your m8</title> ${styleTag} </head> <body> <div id="react-root">${reactString}</div> </body> <script src="https://use.typekit.net/jmr2cqn.js"></script> <script>try{Typekit.load({ async: true });}catch(e){}</script> </html>` ); this.type = "text/html"; this.body = Transmit.injectIntoMarkup(template, reactData, [`${webserver}/dist/client.js`]); callback(null); });
Transmit.renderToString(ReactRouter.RoutingContext, renderProps).then(({reactString, reactData}) => { let template = ( `<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1"> <link rel="icon" type="image/png" href="/favicon.png" /> <link rel="stylesheet" href="https://use.typekit.net/wan8amd.css"> <title>Scott is… your m8</title> ${styleTag} </head> <body> <div id="react-root">${reactString}</div> </body> </html>` ); this.type = "text/html"; this.body = Transmit.injectIntoMarkup(template, reactData, [`${webserver}/dist/client.js`]); callback(null); });
.then((template, {reactString, reactData}) => { const document = template.replace(/<div id="app"><\/div>/, `<div id="app">${reactString}</div>`); const output = Transmit.injectIntoMarkup(document, reactData, ['/built/client.js']); res.send(output); })