Go to file
Kogia-sima c5fc4a64a6 Use `escape_to_string` in tests 2020-06-07 23:01:24 +09:00
benches Bump version (0.0.2 => 0.0.3) 2020-06-07 19:14:23 +09:00
docs/rfcs Add source code 2020-06-05 22:31:38 +09:00
examples Bump version (0.0.2 => 0.0.3) 2020-06-07 19:14:23 +09:00
integration-tests Rename test file (basic.rs => template_once.rs) 2020-06-07 21:48:52 +09:00
resources Add source code 2020-06-05 22:31:38 +09:00
sailfish Use `escape_to_string` in tests 2020-06-07 23:01:24 +09:00
sailfish-compiler Use proc_macro2::fallback::force() API 2020-06-07 20:52:38 +09:00
sailfish-macros Bump version (0.0.2 => 0.0.3) 2020-06-07 19:14:23 +09:00
scripts Fix error caused by -Cpanic=abort option 2020-06-07 22:21:33 +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
.travis.yml Add script to collect coverage on Travis CI 2020-06-07 22:14:32 +09:00
Cargo.lock Bump version (0.0.2 => 0.0.3) 2020-06-07 19:14:23 +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 codecov badge 2020-06-07 22:29:49 +09:00
appveyor.yml Add appveyor.yml 2020-06-07 05:04:21 +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

Build Status Build status Version docs codecov 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.

🐟 Example

Dependencies:

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

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.)
  • Whitespace suppressing
  • Filters (RFC)
  • 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