Rendering Maquette to HTML

301 Views Asked by At

I want to get an HTML string representation of my Maquette view in order to prerender it to a static html file. React has ReactDOMServer.renderToString. Is there a similar method for Maquette VNodes?

1

There are 1 best solutions below

1
On

There is no equivalent for ReactDOMServer.renderToString in maquette (yet).
We had an insightful discussion about it here.
The conclusions were that pre-rendered HTML should not include event-handlers and it should disable all inputs and buttons.
The maquette Projector has a replace method that is then safe to use to enhance the HTML.

Also take into account that in comparison to React, maquette is more lightweight.
So a server render might not even be necessary.