-
Notifications
You must be signed in to change notification settings - Fork 0
Ssg
javarome edited this page May 21, 2024
·
3 revisions
Ssg is Static Site Generation API main class, which is responsible for executing Steps.
Typical usage of Ssg is:
- create a
newinstance with a SsgConfig (which consist basically in a{outDir: string}) -
addSteps to it (mind the order) -
startthe generation with a Context
For instance:
import {SsgConfig, SsgContextImpl, Ssg, ContentStep, CopyStep} from "ssg-api"
const config: SsgConfig = {
getOutputPath(context: SsgContext): string {
return path.join("out", context.file.name)
}
}
const context = new SsgContextImpl("fr")
new Ssg(config)
.add(new ContentStep(contentConfigs, outputFunc))
.add(dir1SubdirectoriesStep)
.add(dir2SubdirectoriesStep)
.add(...anArrayOfSteps)
.add(new CopyStep(copiesToDo))
.start(context)