0.0.2 • Published 3 years ago
fastify-press v0.0.2
fastify-press
Experimental Static Site Generator (SSG) built with Fastify.
Right now it's just a proof of concept using a simple Markdown processor, with no proper client build.
That is, right now it's just generating HTMLs based on a list of URLs from the autoloaded entry files.
The goal is eventually integrate well to fastify-vite.
Usage
async function main (fastify, options) {
await fastify.register(require('fastify-press'))
fastify.press.setProcessor((entry) => {
entry.body = marked(entry.contents)
return entry
})
fastify.press.addEntries(resolve(__dirname, 'entries'))
fastify.press.build(({ add, done }) => {
for (const { name } of values(fastify.press.entries)) {
add(`/entries/${name}`)
}
done()
})
fastify.get('/entries/:entry', ({ params }) => {
return fastify.press.entries[params.entry].body
})
await fastify.ready()
}
License
MIT