Skip to content

Commit bba5987

Browse files
authored
Fixes #258 by ignoring the generated folder (#267)
Fix: #258
1 parent 8903999 commit bba5987

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/site.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,17 @@ pub fn generate(
237237
if watch {
238238
let mut hotwatch = Hotwatch::new().expect("Failed to initialize hotwatch!");
239239
let watch_folder = Arc::clone(input_folder).as_path().to_path_buf();
240+
let out_folder = Arc::clone(output_folder).as_path().to_path_buf();
240241
// Watch the input folder for changes
241242
hotwatch
242243
.watch(watch_folder, move |event: Event| match event.kind {
243244
EventKind::Create(_) | EventKind::Modify(_) | EventKind::Remove(_) => {
244-
info!("Change detected. Rebuilding site...");
245-
rebuild();
245+
for ev in event.paths.iter() {
246+
if !ev.starts_with(fs::canonicalize(out_folder.clone()).unwrap()) {
247+
info!("Change detected. Rebuilding site...");
248+
rebuild();
249+
}
250+
}
246251
}
247252
_ => {}
248253
})

0 commit comments

Comments
 (0)