trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.
https://trunkrs.dev/
Apache License 2.0
3.27k stars 236 forks source link

Prerendering #34

Open MartinKavik opened 3 years ago

MartinKavik commented 3 years ago

Prerendering is important for SEO & SMO, website performance and it allows to use Rust frameworks as static site generators.

Seed templates use react-snap as a non-Rust prerendering tool.

I think we can assume that wasm-bindgen automatically downloads needed webdrivers and there is a browser already installed on the target platform to make testing possible.

So we should be able to implement prerendering using one of these crates:

thedodd commented 3 years ago

@MartinKavik just a quick response here. Given how SSR typically works, I'm thinking that it would be best to ship this functionality as part of the trunk library being designed over in #9. We could add feature switches for the major web server frameworks (tide, warp, actix-web &c), and then folks could just use the trunk::ssr (server-side rendering) middleware to render their app for the HTTP response. The framework used on the frontend wouldn't make a difference.

Thoughts?

MartinKavik commented 3 years ago

I'm not sure if it's directly related to SSR or webserver frameworks. I just want to start Trunk's dev server and generate HTML files automatically through a browser.

In the Seed quickstart, it's the command build:prerender: https://github.com/seed-rs/seed-quickstart-webpack/blob/master/package.json#L12. It's basically a very special case of build:release.

However I understand it may not have to be included in the Trunk core. I've just created thit issue because it will be a show-stopper for moving seed-rs.org and other projects to Trunk.

eribol commented 3 years ago

It is a comment for information. Is there a desing for this proposal.

github-actions[bot] commented 7 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.