ssg-api
TypeScript API to generate a static website.
ssg-api has been developed to generate the RR0 website,
so you'll find examples of Steps and Replacers in the website repository.
Concepts
Step
The Ssg execute a number of Steps, sequentially.
A Step can do anything, but here are some pre-defined steps:
For instance:
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)
.then(result => console.log("Completed", result))
.catch(err => console.error(err, context.inputFile.name, "=>", context.outputFile.name))
Extensibility
You can create:
- your own steps by implementing the SsgStep interface.
- your own context by implementing the SsgContext interface,
typically to provide additional info to the custom .
Replacements
In the case of a ContentStep, predefined replacements are also available: