Skip to content

Render Dom-tree to string (SSR) #29

@njam

Description

@njam

I was wondering how one could render a Dom-tree to an HTML string for server-side-rendering (SSR).

Conceptually I see three options:

  1. Render the application in a headless browser with wasm-bindgen-test. This should be quite easy to set up, but is slow and brittle. (example code)
  2. Adding an intermediary runtime layer in rust-dominator, which wraps dom nodes and operations on dom nodes. So Dom would not store a web_sys::Node but some internal struct, which could either contain a web_sys-node or some internal node representation.
  3. Allow to swap out web_sys at compile-time with a virtual dom library that has a compatible API to web_sys, and provides all the functionality needed by rust-dominator.

What do you think about this topic in general? Are there other ways?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions