mirror of
https://github.com/zyllian/webdog.git
synced 2025-01-18 11:44:35 -08:00
Fix building from scratch
This commit is contained in:
parent
e91bbc38c5
commit
311a6b40d5
2 changed files with 3 additions and 4 deletions
|
@ -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")?;
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue