Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rparrett committed Dec 23, 2024
1 parent bd3b07c commit 78e9e7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/cmd/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,19 @@ pub fn serve(
site = s;
}
}
ChangeKind::Unknown => {
// Probably a user-provided watch location. We can't know exactly what to update.
ChangeKind::ExtraPath => {
let full_paths: Vec<&PathBuf> =
change_group.iter().map(|(_, p, _)| p).collect();
let combined_paths = full_paths
.iter()
.map(|p| p.display().to_string())
.collect::<Vec<String>>()
.join(", ");
console::info(&format!(
"-> {combined_paths} changed. Recreating whole site."
));

// We can't know exactly what to update when a user provides the path.
if let Some(s) = recreate_site() {
site = s;
}
Expand Down
5 changes: 3 additions & 2 deletions src/fs_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ pub enum ChangeKind {
StaticFiles,
Sass,
Config,
Unknown,
/// A change in one of the extra paths to watch provided by the user.
ExtraPath,
}

/// This enum abstracts over the fine-grained group of enums in `notify`.
Expand Down Expand Up @@ -161,7 +162,7 @@ fn detect_change_kind(pwd: &Path, path: &Path, config_path: &Path) -> (ChangeKin
} else if path == config_path {
ChangeKind::Config
} else {
ChangeKind::Unknown
ChangeKind::ExtraPath
};

(change_kind, partial_path)
Expand Down

0 comments on commit 78e9e7c

Please sign in to comment.