generatePagesTask

Summary

Generates static HTML pages from templates and partials. Use this to render your site's main pages (home, about, contact, etc.) with Handlebars or HTML templates.

Default Behavior

With minimal config, renders all .html (or .hbs) files in the specified pagesDir using the provided global context, and writes the output to the specified outDir.

Configuration Options

Example config:

generatePagesTask({
  pagesDir: 'src/pages',
  partialsDir: 'src/partials',
  outDir: 'public',
  pageExt: '.html',
})

Input Expectations

Example:

src/
  pages/
    index.html
    about.html
  partials/
    header.html
    footer.html

Output

Example:

public/
  index.html
  about.html

Practical Example

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

module.exports = [
  generatePagesTask({
    pagesDir: 'src/pages',
    partialsDir: 'src/partials',
    outDir: 'public',
    pageExt: '.html',
  }),
];

Common Pitfalls & Tips

Related Tasks/Docs