Jacky Zhao
2025-03-13 d9159e0ac9bfc22e584c78bc8aa04ecd82c14eea
quartz/plugins/emitters/assets.ts
@@ -15,9 +15,6 @@
export const Assets: QuartzEmitterPlugin = () => {
  return {
    name: "Assets",
    getQuartzComponents() {
      return []
    },
    async getDependencyGraph(ctx, _content, _resources) {
      const { argv, cfg } = ctx
      const graph = new DepGraph<FilePath>()
@@ -36,10 +33,9 @@
      return graph
    },
    async emit({ argv, cfg }, _content, _resources): Promise<FilePath[]> {
    async *emit({ argv, cfg }, _content, _resources) {
      const assetsPath = argv.output
      const fps = await filesToCopy(argv, cfg)
      const res: FilePath[] = []
      for (const fp of fps) {
        const ext = path.extname(fp)
        const src = joinSegments(argv.directory, fp) as FilePath
@@ -49,10 +45,8 @@
        const dir = path.dirname(dest) as FilePath
        await fs.promises.mkdir(dir, { recursive: true }) // ensure dir exists
        await fs.promises.copyFile(src, dest)
        res.push(dest)
        yield dest
      }
      return res
    },
  }
}