Skip to main content

Crate mini_build

Crate mini_build 

Source
Expand description

Builds the directory a static server serves.

This crate takes source folders of CSS, JS, and hand-authored assets and produces one output directory: CSS bundled and/or minified, JS minified or bundled from an entry point, everything else mirrored byte-for-byte. It delegates transformation to external CLI tools (lightningcss, esbuild) rather than embedding a bundler, keeping the crate free of any particular bundler’s dependency weight and release cadence.

It speaks no HTTP and knows nothing about serving. It composes with a static server — mini-static, or any other — through the filesystem: this crate writes a directory, the server serves one. Neither depends on the other.

§Scope

Produce the directory a static server serves. That sentence decides what belongs here: an asset folder mirrored byte-for-byte is in scope even though nothing transforms it, because the output directory is not complete without it. Serving that directory, watching it for a browser’s benefit, or deciding cache headers for it are all somebody else’s job.

§Example

use mini_build::{Builder, CssOptions, CssTool};
use std::path::Path;

Builder::new(Path::new("./public"))?
    .source_folder(Path::new("./src/styles"))?
    .css_tool(CssTool::LightningCss, CssOptions::default())
    .build()?;

Structs§

Broadcaster
Fans change events out to every subscriber.
Builder
Assembles a build: which folders are inputs, which directory receives the output, and which external tools transform what.
ChangeEvent
A file that was added, modified, or removed.
CssOptions
Configuration for crate::Builder::css_tool: independent bundle/minify toggles, all four combinations valid.
JsOptions
Configuration for crate::Builder::js_tool: independent bundle/minify toggles, all four combinations valid.
SourcePipeline
Routes source-folder file changes to the pipeline that turns them into served output.
WatchHandle
A running watch. Dropping it stops the watcher and waits for its thread to finish.

Enums§

BuildError
Why a build could not be configured or could not run.
ChangeType
The kind of file that changed, classified by extension.
CssError
Errors from CSS tool orchestration: discovery, subprocess execution, and output writing.
CssTool
External tools this crate knows how to invoke for CSS bundling/minification.
JsError
Errors from JS tool orchestration.
JsTool
External tools this crate knows how to invoke for JS bundling/minification.
SourceError
Why SourcePipeline could not produce output for a change or build.
ToolError
Why an external tool invocation ([execute]) failed.