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