Go to file
Vince Pike 59150b0134
Stable (#119)
* Update The Version In Preparation For Release

* Update Cargo.lock

---------

Co-authored-by: Vince Pike <vince@oryp9>
Co-authored-by: Vince Pike <25014503+vthg2themax@users.noreply.github.com>
2023-04-13 13:55:50 -04:00
.github Bump MSRV to 1.60.0 2023-03-05 20:28:28 +09:00
assets/javascripts/workers/templates Update actix.stpl, header.stpl, and 53 more files... 2022-11-29 16:34:26 -05:00
benches doc: Fix typo 2021-01-01 18:21:39 +09:00
docs Docs: fix rfc link (#114) 2023-03-18 05:49:29 -04:00
examples build(deps): bump h2 from 0.3.16 to 0.3.17 in /examples (#118) 2023-04-13 13:09:07 -04:00
resources Resize icon for docs.rs 2020-06-18 01:04:10 +09:00
sailfish dep: update syn to v2 (#115) 2023-04-12 10:02:05 -04:00
sailfish-compiler dep: update syn to v2 (#115) 2023-04-12 10:02:05 -04:00
sailfish-macros dep: update syn to v2 (#115) 2023-04-12 10:02:05 -04:00
sailfish-tests dep: update syn to v2 (#115) 2023-04-12 10:02:05 -04:00
scripts Attept to fix the Netlify site error with Python. 2022-02-21 09:26:50 -05:00
syntax Update repository URL 2022-02-19 14:47:00 +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
CHANGELOG.md Switch to TOML Format 2022-03-10 15:20:47 -05:00
Cargo.lock Dependabot/cargo/examples/regex 1.7.3 (#117) 2023-04-13 12:57:31 -04: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 Bump MSRV to 1.60.0 2023-03-05 20:28:28 +09:00
THIRD_PARTY Add THIRD_PARTY 2020-12-23 22:39:31 +09:00
codecov.yml Add codecov.yml 2020-12-30 03:26:24 +09:00
netlify.toml Add documentation sources 2020-06-09 21:19:59 +09:00
requirements.txt Update actix.stpl, header.stpl, and 53 more files... 2022-11-29 16:34:26 -05: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

Tests Version dependency status Rust 1.60 License: MIT

User Guide | API Docs | Examples

Features

  • Simple and intuitive syntax inspired by EJS
  • Include another template file inside template
  • Built-in filters
  • Minimal dependencies (<15 crates in total)
  • Extremely fast (See benchmarks)
  • Better error message
  • Syntax highlighting support (vscode, vim)
  • Works on Rust 1.60 or later

🐟 Example

Dependencies:

[dependencies]
sailfish = "0.6.0"

Template file (templates/hello.stpl):

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

Code:

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.)

👤 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 issues 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