mirror of
https://github.com/apophenia-news/apophenia.news.git
synced 2026-10-29 06:44:56 +00:00
Relative header_image paths (./img.webp) now resolve to /<slug>/img.webp, and article assets also ship unhashed so og:image and JSON-LD URLs resolve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
718 B
JavaScript
26 lines
718 B
JavaScript
import { defineConfig } from "vite";
|
|
import fs from "node:fs";
|
|
import fg from "fast-glob";
|
|
|
|
// Vite hashes images it finds in HTML into /assets/, but og:image and JSON-LD point at /<slug>/<file>, so ship those too
|
|
const articleAssets = {
|
|
name: "article-assets",
|
|
generateBundle() {
|
|
for (const fileName of fg.sync("*/*", { cwd: "src", ignore: ["**/*.html"] }))
|
|
this.emitFile({ type: "asset", fileName, source: fs.readFileSync(`src/${fileName}`) });
|
|
}
|
|
};
|
|
|
|
export default defineConfig({
|
|
root: "src",
|
|
publicDir: "../public",
|
|
plugins: [articleAssets],
|
|
build: {
|
|
outDir: "../dist",
|
|
emptyOutDir: true,
|
|
rollupOptions: {
|
|
input: fg.sync("src/**/*.html", { absolute: true })
|
|
}
|
|
}
|
|
});
|