StaticWeaver
A fast and flexible templating engine for Rust applications.
• Website • Documentation • Report Bug • Request Feature • Contributing Guidelines
Overview
staticweaver is a robust Rust library that provides a flexible and powerful templating engine. Designed for static site generation and more, it offers advanced caching, remote template support, and customizable rendering for optimized performance.
Features
- Flexible Template Rendering: Ideal for static sites, web apps, and other use cases.
- Dynamic Content: Easily interpolate variables in templates with a powerful context system.
- File and String Templates: Render templates from both files and strings.
- Advanced Caching: Improve performance by caching templates for repeated use.
- Custom Rendering: Modify and extend the rendering process to fit your needs.
- Remote Template Support: Fetch and render templates from URLs.
- Comprehensive Error Handling: Gracefully manage template rendering errors.
Installation
Add staticweaver to your Cargo.toml:
[]
= "0.0.1"
Usage
Here's a basic example of how to use staticweaver:
use fs;
use Engine;
use EngineError;
use TemplateError;
use Context;
use Duration;
use Path;
// Helper function to remove all files inside a directory
This example demonstrates rendering a template named "page", replacing {{title}} and {{content}} with values from the context.
Documentation
For full API documentation, please visit docs.rs/staticweaver.
Examples
To explore more examples, clone the repository and run the following command:
cargo run --example example_name
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under either of
at your option.
Acknowledgements
Special thanks to all contributors who have helped build the staticweaver library.