Go to file
Kogia-sima 08dacdd263 Add source code 2020-06-05 22:31:38 +09:00
docs/rfcs Add source code 2020-06-05 22:31:38 +09:00
examples Add source code 2020-06-05 22:31:38 +09:00
integration-tests Add source code 2020-06-05 22:31:38 +09:00
resources Add source code 2020-06-05 22:31:38 +09:00
sailfish Add source code 2020-06-05 22:31:38 +09:00
sailfish-compiler Add source code 2020-06-05 22:31:38 +09:00
sailfish-macros Add source code 2020-06-05 22:31:38 +09:00
syntax Add source code 2020-06-05 22:31:38 +09:00
.gitignore Add source code 2020-06-05 22:31:38 +09:00
Cargo.lock Add source code 2020-06-05 22:31:38 +09:00
Cargo.toml Add source code 2020-06-05 22:31:38 +09:00
LICENSE Add source code 2020-06-05 22:31:38 +09:00
README.md Add source code 2020-06-05 22:31:38 +09:00
rustfmt.toml Add source code 2020-06-05 22:31:38 +09:00

README.md

SailFish

Simple, small, and extremely fast template engine for Rust

Features

  • Simple and intuitive syntax inspired by EJS
  • Relatively small number of dependencies (<15 crates in total)
  • Extremely fast (See benchmarks)
  • Better error message
  • Template rendering is always type-safe because templates are statically compiled.
  • Syntax highlighting support (vscode, vim)
  • Automatically re-compile sources when template file is updated.

⚠️ Currentry sailfish is in early-stage development. You can use this library but be sure that there might be some bugs. Also API is still unstable, and thus may changes frequently.

🐟 Example

Dependencies:

[dependencies]
sailfish = "0.0.1"
sailfish-macros = "0.0.1"

Template file (templates/hello.stpl):

<DOCTYPE! html>
<html>
  <body>
    <%= content %>
  </body>
</html>

Code:

#[macro_use]
extern crate sailfish_macros;  // enable derive macro

use sailfish::TemplateOnce;

#[derive(TemplateOnce)]
#[template(path = "hello.stpl")]
struct Hello {
    content: String
}

fn main() {
    println!("{}", Hello { content: String::from("Hello, world!") }.render_once().unwrap());
}

You can find more examples in examples directory.

🐾 Roadmap

  • Template trait (RFC)
  • Template inheritance (block, partials, etc.)
  • Include another templates without copy
  • Whitespace suppressing
  • HTML minification
  • Filters
  • Dynamic template compilation (RFC)
  • format_templates!(fmt, args..) macro

👤 Author

🇯🇵 Ryohei Machida

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a if this project helped you!

📝 License

Copyright © 2020 Ryohei Machida.

This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator