mirror of
https://github.com/zyllian/webdog.git
synced 2025-01-18 11:44:35 -08:00
Copy files to root on initial build
This commit is contained in:
parent
311a6b40d5
commit
ef470c7fdd
3 changed files with 12 additions and 1 deletions
1
site/root/CNAME
Normal file
1
site/root/CNAME
Normal file
|
@ -0,0 +1 @@
|
|||
zoey.dev
|
|
@ -11,7 +11,7 @@ use pulldown_cmark::{Options, Parser};
|
|||
use serde::Serialize;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use crate::{util, PageMetadata, Site, SASS_PATH, STATIC_PATH};
|
||||
use crate::{util, PageMetadata, Site, ROOT_PATH, SASS_PATH, STATIC_PATH};
|
||||
|
||||
/// Struct containing data to be sent to templates when rendering them.
|
||||
#[derive(Debug, Serialize)]
|
||||
|
@ -83,6 +83,15 @@ impl<'a> SiteBuilder<'a> {
|
|||
.context("Failed to register template file")?;
|
||||
}
|
||||
|
||||
let root_path = self.site.site_path.join(ROOT_PATH);
|
||||
if root_path.exists() {
|
||||
for entry in root_path.read_dir()? {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
std::fs::copy(&path, self.build_path.join(path.strip_prefix(&root_path)?))?;
|
||||
}
|
||||
}
|
||||
|
||||
let static_path = self.site.site_path.join(STATIC_PATH);
|
||||
if static_path.exists() {
|
||||
fs_extra::copy_items(
|
||||
|
|
|
@ -18,6 +18,7 @@ const PAGES_PATH: &str = "pages";
|
|||
const TEMPLATES_PATH: &str = "templates";
|
||||
const STATIC_PATH: &str = "static";
|
||||
const SASS_PATH: &str = "sass";
|
||||
const ROOT_PATH: &str = "root";
|
||||
|
||||
/// Struct for the site's configuration.
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
Loading…
Add table
Reference in a new issue