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();
fs::write(build_dir.join("styles.css"), assets.styles_css).unwrap();
fs::write(build_dir.join("favicon.svg"), assets.favicon_svg).unwrap();
// Get the html template
// For debug builds, read from fs to speed up build
// Otherwise, include as string literal
// Write CSS, JS, and favicon
// (The HTML requires more work!)
for (file, contents) in [
("search.js", assets.search_js),
("styles.css", assets.styles_css),
("favicon.svg", assets.favicon_svg),
] {
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
let template_html = assets