| Page | Layout / Middleware | Component |
|---|---|---|
#[page]
async fn page() -> Markup {
html! {
h1 {
"My title"
}
main .bg-red {
"Some content"
}
}
} |
#[layout]
async fn layout(child: Markup) -> Markup {
html! {
header {
"Welcome to Wini!"
}
(child)
}
} |
#[component]
async fn button() -> Markup {
html! {
button
.btn-blue
onclick="jsFn()"
{
"Blue button!"
}
}
} |
Wini is a set of templates written in Rust for building websites. Instead of using WebAssembly like other common Rust front-end frameworks, Wini templates rely on server-side rendering and when needed TypeScript. Other options are also available, like htmx, Alpine.js, and _hyperscript. (See the doc for htmx and Alpine.js.)
The goal of Wini is therefore to be fast ⚡, lightweight 🪶 and server-side 🌐 oriented.
Even though Wini doesn't use a JavaScript framework and relies purely on vanilla JavaScript, you still have the possibility of installing packages with bun and using them as static files.
- Server side rendering (SSR)
- Static site generation (SSG)
- Creation of concepts like pages, components and layouts
- Compatible with axum's & tower's ecosystems
- Compatible with htmx, alpinejs, hyperscript and similar frameworks
- SEO scoping to pages and layouts
- Caching rules for
Cache-headers and components + pages (cached) - Automatic linking of JavaScript and CSS files
- Default support for TypeScript and Scss
- Advanced error handling and error propagation
- Basic scripting automation in bash or nushell depending on your liking
- Integration with maud for rendering HTML (see the advantages)
- Easily forkable and self-hostability of your own template
You can install Wini with cargo
cargo install winiAfter the installation of wini, you can create a new project with
wini initAll the documentation concerning the inner workings of wini and how to work with it are available at: https://wini.rocks/.
Even though Wini works, it's still in a very early state: Things might not always work as expected and there might be some breaking changes in the future; but if you are curious, and you want to help contribute to this project, you can still try it!