hugo-build

Crates.iohugo-build
lib.rshugo-build
version0.138.0
sourcesrc
created_at2023-07-06 14:16:55.388584
updated_at2024-11-06 17:36:23.24145
descriptionA wrapper around the hugo binary to proving building capabilities.
homepage
repositoryhttps://github.com/apimeister/hugo-build-rs/
max_upload_size
id909939
size21,656
Jens Walter (JensWalter)

documentation

https://docs.rs/hugo_build

README

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.

Usage

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();
}
Commit count: 88

cargo fmt