Hasty Briefsbeta

Bilingual

Show HN: Rocal UI – A simple template engine with Rust

a year ago
  • #Rust
  • #Web Development
  • #Template Engine
  • Rocal UI is a template engine primarily for Rust's Rocal framework but can be used independently.
  • Supports variables with `{{ variable }}` syntax.
  • Includes `if-else` and `else-if` control structures for conditional rendering.
  • Features `for-in` loops similar to Rust's syntax for iterating over collections.
  • Allows string embedding with `{ "string" }` shorthand for `&str` types.
  • Views can be nested or used as partial templates within other views.
  • Variables in `{{ }}` can include any Rust expression that evaluates to `&str`, enabling string interpolation.
  • Installation involves using Cargo to install Rocal with CLI features and initializing a new project.
  • Example usage is provided in `yourapp/src/templates/root_template.rs`.