mirror of
https://github.com/zyllian/webdog.git
synced 2025-01-18 03:32:21 -08:00
fix not rebuilding the entire site when config changes, resolves #18
This commit is contained in:
parent
111a261e7e
commit
dabf4bbe1a
3 changed files with 16 additions and 13 deletions
|
@ -473,4 +473,18 @@ impl SiteBuilder {
|
|||
.ok_or_else(|| eyre!("missing resource: {resource}"))?
|
||||
.build_all(self)
|
||||
}
|
||||
|
||||
/// Builds the entire site.
|
||||
pub fn build_all(&self) -> eyre::Result<()> {
|
||||
self.site.build_all_pages(self)?;
|
||||
self.build_sass()?;
|
||||
|
||||
for (_source_path, config) in self.site.config.resources.iter() {
|
||||
let mut res_builder = ResourceBuilder::new(config.clone());
|
||||
res_builder.load_all(self)?;
|
||||
res_builder.build_all(self)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -178,18 +178,7 @@ impl Site {
|
|||
|
||||
/// Builds the site once.
|
||||
pub fn build_once(self) -> eyre::Result<()> {
|
||||
let builder = SiteBuilder::new(self, false)?.prepare()?;
|
||||
|
||||
builder.site.build_all_pages(&builder)?;
|
||||
builder.build_sass()?;
|
||||
|
||||
for (_source_path, config) in builder.site.config.resources.iter() {
|
||||
let mut res_builder = resource::ResourceBuilder::new(config.clone());
|
||||
res_builder.load_all(&builder)?;
|
||||
res_builder.build_all(&builder)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
SiteBuilder::new(self, false)?.prepare()?.build_all()
|
||||
}
|
||||
|
||||
/// Helper method to build all available pages.
|
||||
|
|
|
@ -98,7 +98,7 @@ fn create(
|
|||
let new_config = serde_yml::from_str(&std::fs::read_to_string(path)?)?;
|
||||
builder.site.config = new_config;
|
||||
builder.reload()?;
|
||||
builder.site.build_all_pages(builder)?;
|
||||
builder.build_all()?;
|
||||
} else if let Ok(_sass_path) = relative_path.strip_prefix(SASS_PATH) {
|
||||
if build {
|
||||
builder.build_sass().wrap_err("Failed to rebuild Sass")?;
|
||||
|
|
Loading…
Add table
Reference in a new issue