高度程序化API-输入路径应该是什么样的?
我有一个aws lambda函数,该功能称为Eleventy.write()或everty.tojson()方法,但似乎无法使其起作用。我已经尝试了不同的项目结构并设置了不同的路径,但是它要么返回一个空数组,要么会引发以下错误 filename.njk不存在templatelayoutpathresolver目录:_includes
当我从终端运行高度
命令时,它会成功构建。 这是我的11ty项目结构
project root folder
-- public (output of the eleventy build)
-- .eleventy.js
-- src (input for the eleventy build)
|-- _data
|-- _includes
我的.eleventy.js文件看起来像这样:
...
return {
dir:{
input: 'src',
output: 'public',
},
};
在lambda功能项目上,write()
调用,我尝试设置相对于文件的输入路径,然后,我尝试将.js文件旁边的11个根文件夹放在.js文件旁边,然后将高度实例化,让Eleventy = new ever elevention(“。”,“ public”)
,我也尝试服用高度root项目的内容并将其放在我正在制作write()
调用的.js文件旁边。
还尝试设置ConfigPath这样的设置
let eleventy = new Eleventy(".", "public", {
configPath: "./.eleventy.js",
});
,但仍无法正常工作。
高度程序化API的文档( https://www.11ty.doc.doc.dev/docs/docs/progmmatic/progmmatic/ < /a>)非常薄,因此任何帮助都将不胜感激。
I have a aws lambda function which calls the eleventy.write() or eleventy.toJSON() method but can't seem to make it work. I have tried different project structures and setting different paths but it either returns an empty array or it throws the following errorTemplateLayoutPathResolver directory does not exist for filename.njk: _includes
When I run the eleventy
command from terminal, it builds successfully.
This is my 11ty project structure
project root folder
-- public (output of the eleventy build)
-- .eleventy.js
-- src (input for the eleventy build)
|-- _data
|-- _includes
my .eleventy.js file looks like this:
...
return {
dir:{
input: 'src',
output: 'public',
},
};
On the lambda function project, where the write()
call is made, I have tried setting the input path relative to the file, then I tried putting the 11ty root folder next to the .js file and instantiating eleventy like let eleventy = new Eleventy(".", "public")
which didn't worked and I also tried taking the content of the eleventy root project and placing it next to the .js file I am making the write()
call.
Also tried setting the configPath like so
let eleventy = new Eleventy(".", "public", {
configPath: "./.eleventy.js",
});
but still not working.
The documentation for the eleventy programmatic API (https://www.11ty.dev/docs/programmatic/) is pretty thin, so any help will be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看您上面的文件列表,在SRC中,我看到
包括
,而不是_includes
。你忘记了下划线吗?Looking at your list of files above, in src, I see
includes
, not_includes
. Did you forget the underscore?只需将输入文件夹设置为“ SRC”
Just set your input folder to "src"