![]() cc #10 |
||
---|---|---|
benches | ||
docs | ||
examples | ||
integration-tests | ||
resources | ||
sailfish | ||
sailfish-compiler | ||
sailfish-macros | ||
scripts | ||
syntax | ||
.gitattributes | ||
.gitignore | ||
.travis.yml | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE | ||
README.md | ||
appveyor.yml | ||
netlify.toml | ||
requirements.txt | ||
runtime.txt | ||
rustfmt.toml |
README.md
✨ 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.4"
sailfish-macros = "0.0.4"
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
- Github: @Kogia-sima
🤝 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