Go to file
Kogia-sima b24861e158 Skip attribute if it is not wrapped with `template` 2020-06-07 03:44:30 +09:00
benches Fix a typo 2020-06-06 18:48:48 +09:00
docs/rfcs Add source code 2020-06-05 22:31:38 +09:00
examples Add example using include! macro 2020-06-06 22:49:27 +09:00
integration-tests Update include-nest test for 76abe1c 2020-06-07 03:23:34 +09:00
resources Add source code 2020-06-05 22:31:38 +09:00
sailfish Bump version (sailfish 0.0.1 => 0.0.2) 2020-06-06 19:26:32 +09:00
sailfish-compiler Skip attribute if it is not wrapped with `template` 2020-06-07 03:44:30 +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 Bump version (sailfish 0.0.1 => 0.0.2) 2020-06-06 19:26:32 +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 docs.rs badge 2020-06-07 01:34:36 +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

Version docs License: MIT PRs Welcome

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.2"
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