コード例 #1
0
				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 => {
コード例 #2
0
ファイル: server.js プロジェクト: jamesslock/james.sl
        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);
        });
コード例 #3
0
 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);
 });
コード例 #4
0
ファイル: server.js プロジェクト: dimaip/neos-react-render
      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 => {
コード例 #5
0
		).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) => {
コード例 #6
0
			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);
			});
コード例 #7
0
ファイル: server.js プロジェクト: iest/scottdotis
        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);
        });
コード例 #8
0
ファイル: server.js プロジェクト: scott-riley/scottdotis
        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);
        });
コード例 #9
0
ファイル: serverEntry.js プロジェクト: psmb/calendar
 .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);
 })