2023-08-17 08:04:15 +03:00
|
|
|
import { FilePath, QUARTZ, joinSegments } from "../../util/path"
|
2023-07-24 03:07:19 +03:00
|
|
|
import { QuartzEmitterPlugin } from "../types"
|
|
|
|
import fs from "fs"
|
2023-08-17 08:04:15 +03:00
|
|
|
import { glob } from "../../util/glob"
|
2023-07-24 03:07:19 +03:00
|
|
|
|
|
|
|
export const Static: QuartzEmitterPlugin = () => ({
|
|
|
|
name: "Static",
|
|
|
|
getQuartzComponents() {
|
|
|
|
return []
|
|
|
|
},
|
2023-08-03 08:10:13 +03:00
|
|
|
async emit({ argv, cfg }, _content, _resources, _emit): Promise<FilePath[]> {
|
2023-08-03 09:04:26 +03:00
|
|
|
const staticPath = joinSegments(QUARTZ, "static")
|
2023-08-03 08:10:13 +03:00
|
|
|
const fps = await glob("**", staticPath, cfg.configuration.ignorePatterns)
|
|
|
|
await fs.promises.cp(staticPath, joinSegments(argv.output, "static"), { recursive: true })
|
2023-08-12 09:25:44 +03:00
|
|
|
return fps.map((fp) => joinSegments(argv.output, "static", fp)) as FilePath[]
|
2023-07-24 03:07:19 +03:00
|
|
|
},
|
|
|
|
})
|