html_generator::performance

Function minify_html

source
pub fn minify_html(file_path: &Path) -> Result<String>
Expand description

Minifies a single HTML file.

This function takes a reference to a Path object for an HTML file and returns a string containing the minified HTML.

§Arguments

  • file_path - A reference to a Path object for the HTML file.

§Returns

  • Result<String, HtmlError> - A result containing a string containing the minified HTML.

§Examples

use std::path::Path;
use html_generator::performance::minify_html;

let path = Path::new("index.html");
match minify_html(path) {
    Ok(minified) => println!("Minified HTML: {}", minified),
    Err(e) => eprintln!("Error: {}", e),
}