Skip to main content

bundle_directory_css

Function bundle_directory_css 

Source
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:

  1. Finds all .css files in src_dir (recursively, sorted by path)
  2. Reads and concatenates all CSS file contents
  3. Writes concatenated content to a temporary file
  4. Runs that through the bundler to resolve imports and minify
  5. 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