prepareOutputTask
Initialize the output directory before building.
When to Use
✅ Use prepareOutputTask as the first task in your pipeline to:
- Ensure the output directory exists
- Clean stale files from previous builds
Quick Start
prepareOutputTask({ outDir: 'public' })Configuration
| Option | Type | Required | Description |
|---|---|---|---|
outDir |
string | ✅ | Output directory path |
Type signature
The exact PrepareOutputConfig interface, transcluded from source so it stays in step with the shipping code:
export interface PrepareOutputConfig {
outDir: string;
}Every task's config type together: API Reference → Config Interfaces.
Why It's Important
Without this task:
- Build may fail if output directory doesn't exist
- Old files from deleted pages remain in output
Always place first in your pipeline:
export default [
prepareOutputTask({ outDir: 'public' }), // ← First!
setGlobalsTask({ /* ... */ }),
generatePagesTask({ /* ... */ }),
// ...
];Related Tasks
- copyStaticTask — Copies files to output
- generatePagesTask — Writes pages to output