Warn when search index is >10MB

This commit is contained in:
Matt Ickstadt 2018-06-13 14:15:27 -05:00
parent 019e74041d
commit b8011de3e8
1 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,9 @@ pub fn create_files(search_config: &Search, destination: &Path, book: &Book) ->
let index = write_to_js(index, &search_config, doc_urls)?;
debug!("Writing search index ✓");
if index.len() > 10_000_000 {
warn!("searchindex.js is very large ({} bytes)", index.len());
}
if search_config.copy_js {
utils::fs::write_file(destination, "searchindex.js", index.as_bytes())?;