Webpack hook for jsongen, [somewhat broken] UI changes

This commit is contained in:
2022-04-24 00:27:51 -04:00
parent 79068f24ee
commit ec9a63570f
23 changed files with 199 additions and 96 deletions
+16
View File
@@ -0,0 +1,16 @@
const fs = require('fs');
const { getAllPosts } = require('./slug');
const { join } = require('path');
const publicDir = join(process.cwd(), 'public');
module.exports = {
cachePostLinkData: () => {
const posts = getAllPosts(['title', 'slug', 'created_at', 'last_updated']);
fs.writeFile(`${publicDir}/posts.json`, JSON.stringify(posts), (e) => {
if (e)
console.error(e);
});
return posts;
}
}