librawssg
A modular static site generator library for Rust. Build your own static site generator with composable, testable, and safe components.
What is librawssg?
librawssg is a collection of Rust crates that provide the core
building blocks for creating a static site generator. It is not a
ready‑to‑use CLI tool, but a framework that gives you full control over your
site’s behaviour.
- Modular architecture – Each aspect (configuration, filesystem, content handling, templating, compilation) is isolated in its own crate.
-
Pluggable processors – Define custom content processors via
the
Processortrait. - Template engine integration – Built‑in support for Tera templates (optional).
- Strong filesystem abstraction – Trait‑based filesystem with built‑in path traversal protection.
- Atomic output generation – The build pipeline writes to a temporary directory and atomically replaces the final output.
- Comprehensive configuration – YAML/JSON support, validation, and nested site/build settings.
Quick Start
Add the facade crate to your Cargo.toml:
[dependencies]
librawssg = "1.0.0"
Then, in your main.rs, assemble a pipeline:
use librawssg::{Config, ContentRule, PipelineBuilder, RealFs, TeraContextBuilder, TeraRenderer};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut config = Config::new().with_site_name("My Site");
config.add_content_rule(ContentRule::new("page", "**/*.raw", "base.tera"));
let mut renderer = TeraRenderer::new();
renderer.load_templates_dir("templates")?;
let pipeline = PipelineBuilder::new()
.config(config)
.content_dir("content")
.output_dir("dist")
.with_fs(Box::new(RealFs))
.with_renderer(Box::new(renderer))
.with_context_builder(Box::new(TeraContextBuilder))
.build()?;
pipeline.run()?;
Ok(())
}
For a complete example, see the Installation page.
Explore the Documentation
- Installation – How to set up a librawssg project.
- Configuration – All configuration options and validation.
- API Reference – Detailed documentation for each crate.
- Contributing – Guidelines for contributing to the project.
- Code of Conduct – Our community standards.
- License – MIT license details.
Repository
The source code is available on GitHub.