Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add support for config named export From Configuration File #3246

@zachleat

Description

@zachleat

Related to #1503 and #3244. Specifically the comment in #1503 (comment)

A more robust way to export config object via your configuration file. We’ll encourage folks to do this from now on instead of returning an object in your configuration callback (or even the set*Directory methods to programmatically set directories).

Setting directories data cascade (order of precedence):

  1. CLI --input (overrides input from any other methods)
  2. CLI --output (overrides output from any other methods)
  3. dir property in return object from configuration callback (backwards compatibility)
  4. set*Directory configuration API methods set*Directory Configuration API methods #1503
  5. config export from configuration file with a dir object inside (this is the new thing)

Examples

ESM

export default function(eleventyConfig) {
  eleventyConfig.directories.input; // has "./content/"
};

export const config = {
  dir: {
    input: "content"
  }
}

CommonJS

module.exports = function(eleventyConfig) {
  eleventyConfig.directories.input; // has "./content/"
};

module.exports.config = {
  dir: {
    input: "content"
  }
}

Update April 10: swapping this to be config instead of directories so that it works the same as the current return object. Switch your return to named config export instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions