Crates.io | hugo-build |
lib.rs | hugo-build |
version | 0.138.0 |
source | src |
created_at | 2023-07-06 14:16:55.388584 |
updated_at | 2024-11-06 17:36:23.24145 |
description | A wrapper around the hugo binary to proving building capabilities. |
homepage | |
repository | https://github.com/apimeister/hugo-build-rs/ |
max_upload_size | |
id | 909939 |
size | 21,656 |
A wrapper around the hugo binary to proving building capabilities.
This crate downloads the hugo binaries on demand during build. So the first build needs connectivity to github.
The version number reflects the hugo version embedded.
Add the depenendy to your cargo.toml
.
cargo add --build hugo-build
Add the following lines to you build.rs
file.
This will build a hugo page from the site
directory and put the output into the target
directory.
use std::path::Path;
fn main() {
let base = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let sources = Path::new(&base).join("site");
let destination = Path::new(&base).join("target").join("site");
println!("cargo:rerun-if-changed={}",sources.display());
hugo_build::init()
.with_input(sources)
.with_output(destination)
.build()
.unwrap();
}