#html #static-site

bin+lib mkhtml

A tool that builds static websites

8 stable releases

Uses old Rust 2015

3.4.0 Oct 22, 2022
3.3.2 Oct 21, 2022
3.3.1 Aug 25, 2022
3.0.0 Jul 6, 2022
2.0.0 Jun 1, 2022

#111 in Build Utils

GPL-3.0-only

19KB
290 lines

mkhtml

Makes HTML files from header.html and footer.html and pages.

Installation

cargo install mkhtml
# !OR!
brew tap jusdepatate/jusdepatate
brew install mkhtml

Building

cargo build     # dev
cargo build -r  # release

Usage

As a binary

  • put your header in parts/header.html,
  • put your footer in parts/footer.html,
  • put your pages in pages/ (can have folders),
  • mkhtml build. (b also works).

Arguments

By default mkhtml will build in the working directory but you can change that by using any of the following arguments:

  • --pages-dir [path],
  • --parts-dir [path],
  • --static-dir [path],
  • --build-dir [path].

(you can use one or more of them, you can use both absolute and relative paths).

As a library

Basic example:

extern crate mkhtmllib;
use mkhtmllib::{mkhtml, Config};

fn main() {
    let mut c = Config::new();
    c.set_pages_dir("path/".to_string());
    mkhtml(c);
}

lib.rs:

mkhtmllib

This is supposed to go along the official Terminal Wrapper, but it is actually just supposed to have any Wrapper,

Makes HTML files from header.html and footer.html and pages,

Used to be a simple bash script that I used to build simple sites years ago, then I lost control over myself..

mkhtml works in a simple way, it builds HTML files using a simple pattern:

  • {header.html}
  • {pages/*}
  • {footer.html}

Built files will be named after their name in pages_dir

Copies {static/*} into {build/static/}.

Dependencies

~240KB