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.
- Change
Event - A file that was added, modified, or removed.
- CssOptions
- Configuration for
crate::Builder::css_tool: independentbundle/minifytoggles, all four combinations valid. - JsOptions
- Configuration for
crate::Builder::js_tool: independentbundle/minifytoggles, all four combinations valid. - Source
Pipeline - Routes source-folder file changes to the pipeline that turns them into served output.
- Watch
Handle - A running watch. Dropping it stops the watcher and waits for its thread to finish.
Enums§
- Build
Error - Why a build could not be configured or could not run.
- Change
Type - 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.
- Source
Error - Why
SourcePipelinecould not produce output for a change or build. - Tool
Error - Why an external tool invocation ([
execute]) failed.