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

build hugo-build

A wrapper around the hugo binary to proving building capabilities

79 releases (30 breaking)

new 0.145.0 Feb 26, 2025
0.143.1 Feb 4, 2025
0.140.2 Dec 30, 2024
0.139.3 Nov 29, 2024
0.116.0 Jul 31, 2023

#155 in Build Utils

Download history 368/week @ 2024-11-01 79/week @ 2024-11-08 157/week @ 2024-11-15 157/week @ 2024-11-22 126/week @ 2024-11-29 274/week @ 2024-12-06 278/week @ 2024-12-13 152/week @ 2024-12-20 170/week @ 2024-12-27 19/week @ 2025-01-03 68/week @ 2025-01-10 191/week @ 2025-01-17 27/week @ 2025-01-24 248/week @ 2025-01-31 44/week @ 2025-02-07 93/week @ 2025-02-14

454 downloads per month

Apache-2.0

19KB
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–19MB
~280K SLoC