- Stable
3.0.0
Toggle Menu
Eleventy
1.93s
Astro
22.90s
Configuration Shapes
You can learn more about the default file names for configuration files.
Callback Function
Callback functions are the preferred method for configuration files and allow you further customization options using Eleventy’s full Configuration API helper methods.
Added in v3.0.0Support for ESM and Asynchronous callbacks was added in Eleventy v3.0.
eleventy.config.js
export default async function(eleventyConfig) {
// Access to the full `eleventyConfig` Configuration API
};
module.exports = async function(eleventyConfig) {
// Access to the full `eleventyConfig` Configuration API
};
Optional: Export config
Object
eleventy.config.js
module.exports = async function(eleventyConfig) {};
module.exports.config = {
dir: {
input: "views",
output: "dist"
}
};
export default async function(eleventyConfig) {};
export const config = {
dir: {
input: "views",
output: "dist"
}
};
Optional: Return Object
Instead of exporting a config
object with your static options, you can return this same object in your configuration callback (though it is not preferred for order-of-operations reasons).
eleventy.config.js
export default async function(eleventyConfig) {
return {
dir: {
input: "views",
output: "dist"
}
};
};
module.exports = async function(eleventyConfig) {
return {
dir: {
input: "views",
output: "dist"
}
};
};
Export Default Object
You can export your static options as the top level default export too, though configuration callback functions are preferred as they allow you to access the full Configuration API.
eleventy.config.js
export default {
dir: {
input: "views"
}
}
module.exports = {
dir: {
input: "views"
}
}