Mattia Samiolo
Mattia Samiolo

Reputation: 571

Create multiple html static files with Yew

Is it possible to create more than one HTML file (with relative JS & WASM modules) from a single Yew project. For example, here I create one artifact with the following:

fn main() {
    yew::Renderer::<App>::new().render();
}

Is it possible to make multiple instance of this and create few HTML output?

Upvotes: 0

Views: 603

Answers (2)

CatWayRoad
CatWayRoad

Reputation: 35

if you are meaning multiple pages within the same website

(For example, example.com/page1 & example.com/page2)

There is a feature called Router in yew

https://yew.rs/docs/concepts/router

if you are meaning hosting multiple website on the same trunk
(For example, hosting both website1.com & website2.com on the same trunk)

I think it is not possible

-- I hope you find this helpful :)

Upvotes: 1

Hytham Soliman
Hytham Soliman

Reputation: 16

What do you mean by [create more than one HTML file]?

each time you call the render it will render your page components. if you did multiple calls, the components will be duplicated on the same page. example:

fn main() {
    yew::Renderer::<App>::new().render();
    yew::Renderer::<App>::new().render();
}

if you wanna build the entire application use router to switch between the pages.

Upvotes: 0

Related Questions