Go to file
Kogia-sima 18ffe5b321 Remove benchmarks
Remove benchmark programs in favor of https://github.com/djc/template-benchmarks-rs

* Quite similar contents
* Some library has too heavy dependencies and frequently cause breaking
changes (which always results in tiny performance difference)
* Some benchmark implementation is out of date
* There is a persistent complaint that the benchmark is wrong (although
I'm not still convinced)

cc #28 #37
2020-12-17 12:51:42 +09:00
benches Remove benchmarks 2020-12-17 12:51:42 +09:00
docs docs: Revert documents 2020-12-17 00:04:47 +09:00
examples no longer requires `extern crate sailfish_macros` 2020-12-16 13:35:37 +09:00
resources Resize icon for docs.rs 2020-06-18 01:04:10 +09:00
sailfish security: Properly handle slices with size greater than isize::MAX 2020-12-17 10:24:28 +09:00
sailfish-compiler refactor: Turn off unused features in dependencies 2020-12-16 20:14:38 +09:00
sailfish-macros Bump version (0.2.2 => 0.2.3) 2020-11-29 21:40:58 +09:00
sailfish-tests Add test for Techempower Framework Benchmarks 2020-12-17 10:02:49 +09:00
scripts skip test in 1.42.0 2020-06-16 22:59:58 +09:00
syntax fix: Fix vim syntax highlighting 2020-07-18 09:31:23 +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
CHANGELOG.md Update CHANGELOG 2020-08-04 09:28:28 +09:00
Cargo.lock Revert "refactor: Use nanorand crate instead of custom xorshift implementation" 2020-12-17 10:07:53 +09:00
Cargo.toml Remove benchmarks 2020-12-17 12:51:42 +09:00
LICENSE Add source code 2020-06-05 22:31:38 +09:00
README.md Remove benchmarks 2020-12-17 12:51:42 +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 NEVER fails unless you explicitly return error.
  • 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.2.3"
sailfish-macros = "0.2.3"

Template file (templates/hello.stpl):

<html>
  <body>
    <% for msg in &messages { %>
      <div><%= msg %></div>
    <% } %>
  </body>
</html>

Code:

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

use sailfish::TemplateOnce;

#[derive(TemplateOnce)]
#[template(path = "hello.stpl")]
struct HelloTemplate {
    messages: Vec<String>
}

fn main() {
    let ctx = HelloTemplate {
        messages: vec![String::from("foo"), String::from("bar")]
    }
    println!("{}", ctx.render_once().unwrap());
}

You can find more examples in examples directory.

🐾 Roadmap

  • Template trait (RFC)
  • Template inheritance (block, partials, etc.)
  • Whitespace suppressing
  • Dynamic template compilation (RFC)
  • format_templates!(fmt, args..) macro

👤 Author

🇯🇵 Ryohei Machida

🤝 Contributing

Contributions, issues and feature requests are welcome!

Since sailfish is an immature library, there are many planned features that is on a stage of RFC. Please leave a comment if you have an idea about its design!

Also I welcome any pull requests to improve sailfish! Find issue with Status: PR Welcome label, and let's create a new pull request!

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