0

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?

cafce25
  • 15,907
  • 4
  • 25
  • 31
Mattia Samiolo
  • 365
  • 2
  • 8

2 Answers2

1

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 :)

CatWayRoad
  • 35
  • 5
0

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.

  • For instance, I would like to create two static html pages from two different components. The code you have written, render the content in a unique index.html file. When I would be nice to have two of them for two different component. (i.e. index_for_comp_1.html and index_for_comp_2.html). Thanks for the response! – Mattia Samiolo Jan 20 '23 at 09:58