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

build hugo-build

A wrapper around the hugo binary to proving building capabilities

67 releases (24 breaking)

new 0.139.4 Dec 9, 2024
0.139.3 Nov 29, 2024
0.138.0 Nov 6, 2024
0.130.0 Jul 29, 2024
0.116.0 Jul 31, 2023

#162 in Build Utils

Download history 165/week @ 2024-08-23 206/week @ 2024-08-30 191/week @ 2024-09-06 188/week @ 2024-09-13 170/week @ 2024-09-20 144/week @ 2024-09-27 14/week @ 2024-10-04 344/week @ 2024-10-11 495/week @ 2024-10-18 88/week @ 2024-10-25 368/week @ 2024-11-01 79/week @ 2024-11-08 157/week @ 2024-11-15 157/week @ 2024-11-22 127/week @ 2024-11-29 554/week @ 2024-12-06

1,004 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–18MB
~273K SLoC