Hauchiwa
A flexible, incremental, graph-based static site generator library for Rust. It provides the building blocks to create your own custom static site generator tailored exactly to your needs.
Unlike traditional SSGs that force a specific directory structure or build pipeline, Hauchiwa gives you a task graph. You define the inputs (files, data), the transformations (markdown parsing, image optimization, SCSS compilation), and the dependencies between them. Hauchiwa handles the parallel execution, caching, and incremental rebuilds.
If you are tired of:
- Rigid frameworks that force their file structure on you (Jekyll, Hugo).
- Complex config files that are hard to debug.
- Bloated JavaScript bundles for simple static content.
Then Hauchiwa is for you.
Key Features
- Task Graph Architecture: Define your build as a dependency graph. If Task B needs Task A, Hauchiwa ensures they run in order.
- Incremental: Because it knows the graph, Hauchiwa only rebuilds what has really changed.
- Parallel: Tasks run in parallel automatically.
- Type-safe: Leveraging Rust's type system to ensure dependencies are sound.
- Asset pipeline: Built-in support for:
- Images: Automatic optimization via
imageand caching. - Sass/SCSS: Compilation via
grass. - JavaScript: Bundling and minification via
esbuild. - Svelte: SSR and hydration support via
denoandesbuild.
- Images: Automatic optimization via
Core Concepts
- Blueprint: The blueprint of your site. You use this to register tasks and loaders.
- Task: A single unit of work. Tasks can depend on other tasks.
- Handle: A reference to the future result of a task. You pass these to other tasks to define dependencies.
- Loader: A kind of a task that reads data from the filesystem (e.g., markdown files, images).
- Website: The engine that converts the graph defined in
Blueprintinto a proper static website.
Quick Start
Add hauchiwa to your Cargo.toml:
[]
# Check crates.io for the latest version
= "*"
# Serde is needed to parse frontmatter
= { = "1", = ["derive"] }
Create your generator in src/main.rs:
use ;
use Deserialize;
// 1. Define your content structure (Frontmatter)
Feature flags
By default, Hauchiwa is built with the following features, but you can opt out
of them by disabling them in your Cargo.toml file, if you don't need them.
grass: Enables SCSS/Sass compilation.image: Enables image optimization (WebP, resizing).tokio: Enables the Tokio runtime for async tasks.live: Enables live-reload during development.server: Enables the built-in development server.
Documentation
The best place to learn is the API Documentation. It covers the core concepts in depth.
Examples
License
GPL-2.0 or later.