Skip to content

Prerender precompile #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Trial without RoutingContext
  • Loading branch information
dmose authored and Dan Mosedale committed Sep 6, 2016
commit 31d47433d017f3e4cc879e8316e3aa2e25697de2
14 changes: 9 additions & 5 deletions bin/generate-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const ReactDOMServer = require("react-dom/server");
const store = require("../content-src/store.js");

const {Provider} = require("react-redux");
const Routes = require("components/Routes/Routes");
const {RoutingContext} = require("components/Routes/Routes");
const NewTabPage = require("components/NewTabPage/NewTabPage");
const defaults = {
baseUrl: "",
title: "Loading...",
Expand All @@ -25,16 +26,19 @@ function template(rawOptions) {
console.error("before createClass");
const Root = React.createClass({
render() {
return (
<Provider store={store}>
<Routes />
const content = (
<Provider store={store}>
<NewTabPage />
</Provider>
);

console.error("content = ", content);
return content;
}
});

console.error("before string render");
const preRenderedContent = ReactDOMServer.renderToString(React.createElement(Root));
const preRenderedContent = ReactDOMServer.renderToString(<Root />);

console.error("before return");
return `<!doctype html>
Expand Down