Skip to main content

generate_html

Function generate_html 

Source
pub async fn generate_html(
    www_dir: &Path,
    import_path: &str,
    is_release: bool,
    custom_index_html: &Option<PathBuf>,
) -> Result<String, EuvError>
Expand description

Generates index.html based on the build profile.

Uses INDEX_HTML_RELEASE when is_release is true (no live-reload script), otherwise uses INDEX_HTML_DEV (includes live-reload instrumentation).

Then writes the template with the import path placeholder replaced to disk.

§Arguments

  • &Path - The path to the www directory where index.html will be written.
  • &str - The JS import path relative to the www directory (e.g. ./pkg/euv or ./euv).
  • bool - Whether to use the release template (no live-reload).

§Returns

  • Result<String, EuvError> - The generated HTML content written to disk.