slightly better error messages

This commit is contained in:
Bryce Miller 2023-05-06 12:27:08 +02:00
parent 8bd80406e6
commit 54da8acb0c
No known key found for this signature in database
GPG key ID: F1E97BF8DF152350

View file

@ -80,13 +80,22 @@ pub fn generate_docs_html(root_file: PathBuf) {
} }
})(); })();
fs::write(build_dir.join("search.js"), assets.search_js).unwrap(); // Write CSS, JS, and favicon
fs::write(build_dir.join("styles.css"), assets.styles_css).unwrap(); // (The HTML requires more work!)
fs::write(build_dir.join("favicon.svg"), assets.favicon_svg).unwrap(); for (file, contents) in [
("search.js", assets.search_js),
// Get the html template ("styles.css", assets.styles_css),
// For debug builds, read from fs to speed up build ("favicon.svg", assets.favicon_svg),
// Otherwise, include as string literal ] {
let dir = build_dir.join(file);
fs::write(&dir, contents).unwrap_or_else(|error| {
panic!(
"Attempted to write {} but failed with this error: {}",
dir.display(),
error
)
})
}
// Insert asset urls & sidebar links // Insert asset urls & sidebar links
let template_html = assets let template_html = assets