【发布时间】:2021-08-26 00:58:31
【问题描述】:
在 Eleventy 的文档 (https://www.11ty.dev/docs/data-global-custom/) 中,它声明您可以使用以下选项作为添加自定义全局数据的一个选项:
// .eleventy.js
module.exports = function(eleventyConfig) {
eleventyConfig.addGlobalData("myFunctionPromise", () => {
return new Promise((resolve) => {
setTimeout(resolve, 100, "foo");
})
});
};
当尝试在 .eleventy.js 项目配置文件中使用它时,它失败了:
> eleventyConfig.addGlobalData is not a function
但是,可以使用eleventyConfig.addCollection 在eleventyConfig 上定义自定义集合,没有任何问题。
这里有什么问题?
【问题讨论】:
标签: node.js eleventy static-site-generation