diff --git a/src/builder.rs b/src/builder.rs index bcb8c44..f5a26c8 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -184,6 +184,9 @@ impl<'a> SiteBuilder<'a> { /// Builds the Sass styles in the site. pub fn build_sass(&self) -> anyhow::Result<()> { let styles_path = self.build_path.join("styles"); + if !styles_path.exists() { + std::fs::create_dir(&styles_path)?; + } if self.serving { util::remove_dir_contents(&styles_path) .context("Failed to remove old contents of styles directory")?; diff --git a/src/util.rs b/src/util.rs index 8625a9e..7fa90c8 100644 --- a/src/util.rs +++ b/src/util.rs @@ -4,10 +4,6 @@ use std::path::Path; /// Simple helper to remove the contents of a directory without removing the directory itself. pub fn remove_dir_contents(path: &Path) -> anyhow::Result<()> { - if !path.exists() { - std::fs::create_dir_all(path)?; - return Ok(()); - } for entry in path.read_dir()? { let entry = entry?; let path = entry.path();