| Crates.io | rusty-handlebars |
| lib.rs | rusty-handlebars |
| version | 0.1.3 |
| created_at | 2025-03-17 23:13:17.664002+00 |
| updated_at | 2025-07-22 01:46:58.673889+00 |
| description | Fast compile time handlebars template engine for Rust |
| homepage | |
| repository | https://github.com/h-i-v-e/rusty-handlebars |
| max_upload_size | |
| id | 1595978 |
| size | 49,766 |
A Rust implementation of Handlebars templating engine with a focus on type safety and compile-time template processing.
minify-html feature#[derive(WithRustyHandlebars)]parser featureAdd this to your Cargo.toml:
[dependencies]
rusty-handlebars = "0.1.0"
For HTML minification support, enable the minify-html feature:
[dependencies]
rusty-handlebars = { version = "0.1.0", features = ["minify-html"] }
use rusty_handlebars::WithRustyHandlebars;
#[derive(WithRustyHandlebars)]
#[template(path = "templates/hello.hbs")]
struct HelloTemplate {
name: String,
}
use rusty_handlebars::AsDisplayHtml;
let html = "<script>alert('xss')</script>";
let safe_html = html.as_display_html().to_string();
// Output: <script>alert('xss')</script>
{{field_name}}{{#if}}...{{/if}} for conditional rendering{{#each}}...{{/each}}parser featureEnables template parsing functionality. This is optional and can be enabled with:
[dependencies]
rusty-handlebars = { version = "0.1.10", features = ["parser"] }
minify-html featureEnables HTML minification for reduced output size:
[dependencies]
rusty-handlebars = { version = "0.1.10", features = ["minify-html"] }
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.