高度程序化API-输入路径应该是什么样的?

发布于 2025-01-30 06:09:19 字数 1159 浏览 4 评论 0原文

我有一个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 error
TemplateLayoutPathResolver 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情魔剑神 2025-02-06 06:09:19

查看您上面的文件列表,在SRC中,我看到包括,而不是_includes。你忘记了下划线吗?

Looking at your list of files above, in src, I see includes, not _includes. Did you forget the underscore?

故人如初 2025-02-06 06:09:19

只需将输入文件夹设置为“ SRC”

let eleventy = new Eleventy("src", "public");

Just set your input folder to "src"

let eleventy = new Eleventy("src", "public");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文