#hugo #build #build-dependencies #site #building #github #binary

build hugo-build

A wrapper around the hugo binary to proving building capabilities

61 releases (22 breaking)

new 0.137.0 Nov 4, 2024
0.135.0 Sep 27, 2024
0.130.0 Jul 29, 2024
0.124.1 Mar 20, 2024
0.116.0 Jul 31, 2023

#140 in Build Utils

Download history 127/week @ 2024-07-15 79/week @ 2024-07-22 397/week @ 2024-07-29 14/week @ 2024-08-05 470/week @ 2024-08-12 67/week @ 2024-08-19 169/week @ 2024-08-26 257/week @ 2024-09-02 140/week @ 2024-09-09 231/week @ 2024-09-16 213/week @ 2024-09-23 49/week @ 2024-09-30 9/week @ 2024-10-07 465/week @ 2024-10-14 447/week @ 2024-10-21 18/week @ 2024-10-28

939 downloads per month

Apache-2.0

8KB
129 lines

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();
}

Dependencies

~6–20MB
~273K SLoC