Kind: Interface
Source: src/helper/ssg/ssg.ts
Part of: Helper
ToSSGOptions configures static site generation in the SSG helper. It defines the output directory, request and generation hooks, concurrency, extension mappings, and plugins used during generation.
Properties
| Property | Type |
|---|---|
dir | string |
beforeRequestHook | `BeforeRequestHook |
afterResponseHook | `AfterResponseHook |
afterGenerateHook | `AfterGenerateHook |
concurrency | number |
extensionMap | Record<string, string> |
plugins | SSGPlugin[] |
Diagram
mermaidgraph LR Options[ToSSGOptions] Options --> Dir[dir] Options --> Before[beforeRequestHook] Options --> AfterResponse[afterResponseHook] Options --> AfterGenerate[afterGenerateHook] Options --> Concurrency[concurrency] Options --> Extensions[extensionMap] Options --> Plugins[plugins]
Usage
tsimport type { ToSSGOptions } from './ssg'
const options: ToSSGOptions = {
dir: './dist',
beforeRequestHook: async () => {
// Run before an SSG request.
},
afterResponseHook: async () => {
// Run after an SSG response.
},
afterGenerateHook: async () => {
// Run after generated output is written.
},
concurrency: 4,
extensionMap: {
'.html': '.html',
'.json': '.json',
},
plugins: [],
}
AI Coding Instructions
- Set
dirto the directory where generated files should be written. - Accept either a single hook or an array of hooks for each hook field.
- Keep
beforeRequestHook,afterResponseHook, andafterGenerateHookaligned with their execution stage. - Set
extensionMapentries to map generated source extensions to output extensions. - Pass SSG integrations through
pluginsasSSGPlugininstances.
Was this page helpful?