Go to file
Kogia-sima 48eb36560a Resize icon for docs.rs 2020-06-18 01:04:10 +09:00
benches Update benchmark result 2020-06-17 00:00:12 +09:00
docs Bump version (0.0.5 => 0.1.0) 2020-06-15 12:17:19 +09:00
examples Change target name in examples/Cargo.toml 2020-06-17 00:53:12 +09:00
integration-tests Bump version (0.0.5 => 0.1.0) 2020-06-15 12:17:19 +09:00
resources Resize icon for docs.rs 2020-06-18 01:04:10 +09:00
sailfish fix: Handle capacity overflow 2020-06-18 00:49:59 +09:00
sailfish-compiler Bump version (0.0.5 => 0.1.0) 2020-06-15 12:17:19 +09:00
sailfish-macros Downgrade proc-macro2 minimum version in sailfish-macros 2020-06-16 19:46:38 +09:00
scripts skip test in 1.42.0 2020-06-16 22:59:58 +09:00
syntax Add source code 2020-06-05 22:31:38 +09:00
.gitattributes Add .gitattributes 2020-06-10 00:00:20 +09:00
.gitignore Add source code 2020-06-05 22:31:38 +09:00
.travis.yml Fix Rust version in .travis.yml 2020-06-16 22:32:49 +09:00
Cargo.lock Change target name in examples/Cargo.toml 2020-06-17 00:53:12 +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 Minimum supported Rust version in README 2020-06-17 00:08:40 +09:00
appveyor.yml Speedup appveyor build 2020-06-10 19:15:39 +09:00
netlify.toml Add documentation sources 2020-06-09 21:19:59 +09:00
requirements.txt Add documentation sources 2020-06-09 21:19:59 +09:00
runtime.txt Update Python version 2020-06-09 21:34:46 +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 License: MIT

User Guide | API Docs | Examples

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.
  • Works on Rust 1.42 or later

🐟 Example

Dependencies:

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

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