Crates.io | hugo-build |
lib.rs | hugo-build |
version | |
source | src |
created_at | 2023-07-06 14:16:55.388584 |
updated_at | 2024-12-09 20:21:03.218415 |
description | A wrapper around the hugo binary to proving building capabilities. |
homepage | |
repository | https://github.com/apimeister/hugo-build-rs/ |
max_upload_size | |
id | 909939 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
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();
}