Skip to content

Server Side Rendering #63

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
1 of 3 tasks
smfoote opened this issue May 29, 2015 · 3 comments
Open
1 of 3 tasks

Server Side Rendering #63

smfoote opened this issue May 29, 2015 · 3 comments
Assignees

Comments

@smfoote
Copy link
Owner

smfoote commented May 29, 2015

Tornado templates should be able to render on the server with Node. There are Node implementations of the DOM API (e.g. simple-dom) that should get us most of the way there, but there are still a few things lacking.

  • tornado#render may need to return a promise that resolves when all internal promises have resolved, because values that resolve after the server responds would otherwise not be included in the HTML payload.
  • simple-dom does not support the innerHTML property, which is used within the Tornado runtime, and seems like the easiest way to turn the DOM returned by Tornado into a string.
  • because Tornado creates DOM instead of strings, it seems like streaming (and thus early flush) is not possible. This needs further investigation.
@smfoote
Copy link
Owner Author

smfoote commented Jun 25, 2015

The new version of the compiler allows us to compile to whatever we want (or compile to one language in different ways). We should consider this as a part of our SSR discussion.

@smfoote
Copy link
Owner Author

smfoote commented Jul 8, 2015

Although simple-dom doesn't support innerHTML and outerHTML, it does have a method for turning an HTML Node into a string: HTMLSerializer#serialize.

An example of how to implement innerHTML using serializer can be found in the Riot project

@smfoote smfoote self-assigned this Jul 13, 2015
@smfoote
Copy link
Owner Author

smfoote commented Jul 21, 2015

A working version of SSR can be found at #102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant