mirror of
https://github.com/zyllian/zyllian.github.io.git
synced 2025-05-09 18:16:43 -07: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
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue