pub async fn bundle_directory_css(
src_dir: &Path,
output_path: &Path,
) -> Result<(), CssBundlerError>Expand description
Bundle all CSS files from a source directory into a single output file.
Discovers all .css files in src_dir, reads and concatenates them (in sorted order),
follows @import statements within that directory, minifies the result, and writes it
to output_path.
The bundling process:
- Finds all
.cssfiles in src_dir (recursively, sorted by path) - Reads and concatenates all CSS file contents
- Writes concatenated content to a temporary file
- Runs that through the bundler to resolve imports and minify
- Writes the final bytes to output_path
ยงErrors
Returns Err if:
- src_dir cannot be read
- output_path cannot be written to
- CSS parsing or bundling fails