Add Sass support

This commit is contained in:
Zoey 2021-08-19 13:43:45 -07:00
parent e06c4371f4
commit 5e1913c9de
9 changed files with 525 additions and 205 deletions

22
src/util.rs Normal file
View file

@ -0,0 +1,22 @@
//! Module containing various utilities.
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();
if path.is_file() {
std::fs::remove_file(&path)?;
} else {
std::fs::remove_dir_all(&path)?;
}
}
Ok(())
}