setGlobalsTask

Sets global variables for use in templates and tasks. Use this to define site-wide values (site title, author, base URL, etc.) that are available everywhere in your pipeline.

Summary

Sets global variables for use in templates and tasks. Use this to define site-wide values (site title, author, base URL, etc.) that are available everywhere in your pipeline.

Default Behavior

With minimal config, sets the provided key-value pairs onto the global context. These values are accessible in all templates and subsequent tasks.

Configuration Options

Example config (static):

setGlobalsTask({
  values: {
    siteTitle: 'My Blog',
    author: 'Jane Doe',
    baseUrl: 'https://example.com',
  }
})

Example config (dynamic):

setGlobalsTask({
  valuesFn: globals => ({
    latestVersion: extractVersion(globals.changelogHtml)
  })
})

Input Expectations

Output

Practical Example

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

module.exports = [
  setGlobalsTask({
    values: {
      siteTitle: 'My Blog',
      author: 'Jane Doe',
    }
  }),
  // ...other tasks
];

Common Pitfalls & Tips

Related Tasks/Docs