To use maomi, rust 1.65+ is required. Then add maomi as cargo dependencies. In Cargo.toml:
In real world, some other crates are also needed:
A page is composed by components. To generate a page with maomi, write a component first.
A component is a struct with "#[component]" attribute:
The struct must contain a "template!" field. It contains the template of this component.
The "Component" trait should be implemented for the component struct:
Finally, this component can be put into the page body.
Compile the code with wasm-pack
The generated code is under the "pkg" directory.
Write an HTML file with empty <body>.
Then serve it in an HTTP server and see the result!