1 unstable release
0.1.0 | Jan 10, 2024 |
---|
#43 in #ssg
Used in ibex_alpha
47KB
979 lines
Ibex
Ibex provides ergonomic HTML templating in Rust for SSG/SSR, using procedural macros.
Still a work in progress.
Check out Ibex Template for a quick start.
Example
fn at_blog(blog: BlogPost) -> Document {
// Creates a `View` and converts to `Document`
view! {
// Calls a function `header(true)`
@header[true]
// Some html elements
h2 { [blog.title] }
h3 { i {[blog.author]} }
// Include any variables in scope
p {
[blog.body]
}
// Variables can be used in attributes
// Use a slash to signify an empty element body
img [src=blog.image]/
// Any syntax can be used with `if` or `for` statements (except `else-if`)
[:if let Some(image_src) = blog.image {
image [src=image_src]/
}]
}
.into()
}
Dependencies
~230–670KB
~16K SLoC