prepareOutputTask

Summary

Ensures the output directory exists and is ready for site generation. This is typically the first task in your pipeline and prevents errors from missing or stale output folders.

Default Behavior

By default, creates the specified output directory (outDir) if it does not exist, and optionally empties it before the build if clean is enabled.

Configuration Options

Example config:

prepareOutputTask({
  outDir: 'public',
})

Input Expectations

Output

Practical Example

const { prepareOutputTask } = require('skier/builtins');

module.exports = [
  prepareOutputTask({
    outDir: 'public',
  }),
  // ...other tasks
];

Common Pitfalls & Tips

Related Tasks/Docs