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

build hugo-build

A wrapper around the hugo binary to proving building capabilities

76 releases (29 breaking)

new 0.144.0 Feb 17, 2025
0.142.0 Jan 22, 2025
0.140.2 Dec 30, 2024
0.139.3 Nov 29, 2024
0.116.0 Jul 31, 2023

#157 in Build Utils

Download history 18/week @ 2024-10-28 423/week @ 2024-11-04 23/week @ 2024-11-11 281/week @ 2024-11-18 143/week @ 2024-11-25 16/week @ 2024-12-02 377/week @ 2024-12-09 198/week @ 2024-12-16 152/week @ 2024-12-23 157/week @ 2024-12-30 6/week @ 2025-01-06 123/week @ 2025-01-13 153/week @ 2025-01-20 112/week @ 2025-01-27 175/week @ 2025-02-03 39/week @ 2025-02-10

485 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
~287K SLoC