-
Notifications
You must be signed in to change notification settings - Fork 0
Steps
Jérôme Beau edited this page Nov 11, 2022
·
9 revisions
The Ssg execute a number of Steps, sequentially. A Step can do anything and return its own results.
Some predefined steps are provided:
- CopyStep copies files;
- ContentStep executes a series of ReplaceCommands, sequentially.
- DirectoryStep completes a template based on sub-directories, sequentially (to produce a listing of them, typically).
Example:
import {SsgConfig, SsgContextImpl, Ssg, ContentStep, CopyStep} from "ssg-api"
const config: SsgConfig = {outDir: "out"}
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)You can create your own steps by implementing the SsgStep interface.