Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/myfavshrimp/remplate
Experiments with compile-time templating
https://github.com/myfavshrimp/remplate
Last synced: about 2 months ago
JSON representation
Experiments with compile-time templating
- Host: GitHub
- URL: https://github.com/myfavshrimp/remplate
- Owner: myFavShrimp
- License: mit
- Created: 2024-04-16T15:11:59.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-08T16:06:00.000Z (9 months ago)
- Last Synced: 2024-11-30T13:59:44.554Z (about 2 months ago)
- Language: Rust
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# remplate
Templating that feels Rust-native
## Features
- regular Rust syntax in code blocks
- support for `format!`-macro syntax## Usage
```rust
// my_template.html{
let title = "My Awesome Template";
let paragraph = "Lorem ipsum etc.";
}{ title }
{ paragraph }
{
let debug_info = if self.debug_enabled {
Some("debug is enabled")
} else {
None
};debug_info:?
}
``````rust
// src/main.rs#[derive(remplate::Remplate)]
#[remplate(path = "my_template.html")]
struct MyTemplate {
debug_enabled: bool,
}fn main() {
println!(
"{}",
MyTemplate {
debug_enabled: true
}
);
}
``````html
~/remplate-example: cargo run
Compiling remplate-example v0.1.0 (/home/user/remplate-example)
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/remplate-example`My Awesome Template
Lorem ipsum etc.
Some("debug is enabled")
```