Generate static routes
Reading routes from dioxus' Router would be nice. These routes should then be generated as static html files when executing dioxus build for a web app.
So a
Link {
to: "/foo/bar",
}
would generate dist/foo/bar/index.html.
This is what nuxt generate does for example.
Additionally (or maybe as an easier first step) there should be an option in Dioxus.toml what routes are generated.
so we need check route info and generate the file ?
but the router is manage with dioxus-router, so we cannot know what we need generate.
Reading routes from dioxus'
Routerwould be nice. These routes should then be generated as static html files when executingdioxus buildfor a web app.So a
Link { to: "/foo/bar", }would generate
dist/foo/bar/index.html.This is what
nuxt generatedoes for example.Additionally (or maybe as an easier first step) there should be an option in Dioxus.toml what routes are generated.
I actually really like this concept - we could allow a hardcoded list or just look around for the Router component and parse out the contents.
Reading routes from dioxus'
Routerwould be nice. These routes should then be generated as static html files when executingdioxus buildfor a web app. So aLink { to: "/foo/bar", }would generate
dist/foo/bar/index.html. This is whatnuxt generatedoes for example. Additionally (or maybe as an easier first step) there should be an option in Dioxus.toml what routes are generated.I actually really like this concept - we could allow a hardcoded list or just look around for the Router component and parse out the contents.
but how can we generate the xxx/index.html file
Reading routes from dioxus'
Routerwould be nice. These routes should then be generated as static html files when executingdioxus buildfor a web app. So aLink { to: "/foo/bar", }would generate
dist/foo/bar/index.html. This is whatnuxt generatedoes for example. Additionally (or maybe as an easier first step) there should be an option in Dioxus.toml what routes are generated.I actually really like this concept - we could allow a hardcoded list or just look around for the Router component and parse out the contents.
but how can we generate the
xxx/index.htmlfile
A "dumb" way would be to spin up a local dev server and scrape it once the page loaded. A more sophisticated way would be to have an "SSR" entry point in your code (alongside other potential entrypoints) that gets called with some environment-driven context.
fn main_web() {
dioxus::web::launch(app);
}
fn main_ssr() {
dioxus::ssr::static_gen(app) // prints to stdout
}
use dioxus::ssr::static_gen for each page components ?
We don't have a static_gen function yet but I could imagine it would pull from environment variables or stdin or IPC and be commanded by the CLI to generate each page.
We need to allow the CLI to interact with the program.