Skip to content
javarome edited this page May 21, 2024 · 4 revisions

Install ssg-api as a project dependency:

npm install --save ssg-api

Then import the required types to implement your own SSG code:

import { Ssg, SsgConfig, SsgContextImpl } from "ssg-api"

const config: SsgConfig = {
  getOutputPath(context: SsgContext): string {
    return path.join("out", context.file.name)
  }
}
const ssg = new Ssg(config)
  .add(firstStep)
  .add(nextStep)  // See "Concepts" for a description of steps

const context = new SsgContextImpl("fr")
try {
  const result = await ssg.start(context)
  console.log("Completed", result)
} catch (e) {
  console.error(err, context.file.name)
}

Also see setup for Testing

Clone this wiki locally