Skip to content

Commit

Permalink
Merge pull request #24 from this-is-tobi/develop
Browse files Browse the repository at this point in the history
fix: keep directories sctructures when adding content
  • Loading branch information
this-is-tobi authored Nov 11, 2024
2 parents 3388058 + fbae6a5 commit 297033a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/lib/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,19 @@ export function addExtraPages(paths: string[]) {
return nav
}

export function addContent(path: string | string[], dir: string, fn?: () => void) {
const files = extractFiles(path)

for (const file of files) {
const src = resolve(process.cwd(), file)
const dest = resolve(dir, basename(file))
if (fn) {
fn()
export function addContent(paths: string | string[], dir: string, fn?: () => void) {
for (const path of Array.isArray(paths) ? paths : [paths]) {
const absolutePath = resolve(process.cwd(), path)
const files = extractFiles(absolutePath)

for (const file of files) {
const src = resolve(process.cwd(), file)
const dest = resolve(dir, file.replace(absolutePath, '.'))
if (fn) {
fn()
}
cpSync(src, dest)
}
cpSync(src, dest)
}
}

Expand Down

0 comments on commit 297033a

Please sign in to comment.