Crates.io | shtola |
lib.rs | shtola |
version | 0.4.4 |
source | src |
created_at | 2019-11-12 14:59:34.101024 |
updated_at | 2023-03-19 16:32:57.211135 |
description | Minimal static site generator |
homepage | https://codeberg.org/shadows_withal/shtola |
repository | https://codeberg.org/shadows_withal/shtola |
max_upload_size | |
id | 180670 |
size | 67,648 |
Shtola is a library for generic file processing. It enables you to build your own applications that function as static site generators! Here's an example:
use shtola::{Plugin, RefIR, ShFile, Shtola};
use std::time::SystemTime;
fn plugin() -> Plugin {
Box::new(|mut ir: RefIR| {
// Let's create our file in the IR (intermediate representation) file hash map!
let current_time = SystemTime::now();
ir.files.insert(
"current_time.txt".into(),
ShFile {
content: format!("{:?}", current_time).into(),
..ShFile::default()
},
);
})
}
fn main() {
let mut s = Shtola::new();
s.source("fixtures/empty");
s.destination("fixtures/dest_systemtime");
s.register(plugin());
s.build().expect("Build failed!");
// Now we have a "current_time.txt" file in our destination directory that
// contains the current system time!
}
Add the latest version of Shtola to your Cargo.toml
.