lit-html-rs

A Rust library for using the HTML template library lit-html.

this library is still in very early stages

```rust use js::; use lit_html::;

[no_mangle]

pub fn main() { let data = TemplateData::new(); data.set("name", "Ferris"); render(html!(r#"

Hello ${.name}

"#, &data), DOMBODY); } ```

See it working here.

Example

```rust use js::; use lit_html::;

static mut COUNT: u32 = 0;

fn counter() -> Template { let data = TemplateData::new(); data.set("count", unsafe { COUNT }); data.set("increment", || { unsafe { COUNT += 1 }; rerender(); }); html!( r#"The current count is ${_.count} "#, &data ) }

fn app() -> Template { let data = TemplateData::new(); data.set("content", &counter()); html!( r#"

This is a counter in Rust!
${_.content}
"#, &data ) }

fn rerender() { render(&app(), DOM_BODY); }

[no_mangle]

pub fn main() { rerender(); } ```

See it working here.