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

build hugo-build

A wrapper around the hugo binary to proving building capabilities

71 releases (25 breaking)

0.140.2 Dec 30, 2024
0.139.5 Dec 15, 2024
0.139.3 Nov 29, 2024
0.130.0 Jul 29, 2024
0.116.0 Jul 31, 2023

#145 in Build Utils

Download history 207/week @ 2024-09-18 177/week @ 2024-09-25 25/week @ 2024-10-02 80/week @ 2024-10-09 612/week @ 2024-10-16 234/week @ 2024-10-23 178/week @ 2024-10-30 263/week @ 2024-11-06 142/week @ 2024-11-13 173/week @ 2024-11-20 129/week @ 2024-11-27 180/week @ 2024-12-04 319/week @ 2024-12-11 190/week @ 2024-12-18 178/week @ 2024-12-25 33/week @ 2025-01-01

821 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–19MB
~283K SLoC