gpt4 book ai didi

javascript - jade/pug 是否可以在 include 语句中使用变量?

转载 作者:行者123 更新时间:2023-11-30 00:09:29 24 4
gpt4 key购买 nike

我正在开发 nodejs 应用程序,我对 include 语句有疑问。当我这样使用它时它会起作用:

include ../mixins/root.pug

...但是可以在 include 上使用变量吗?

这些都不起作用:

include #{process.env.MIXINS_PATH}/root.pug
include !{process.env.MIXINS_PATH}/root.pug
include `${process.env.MIXINS_PATH}/root.pug`

结果是这样的:

Error: ENOENT: no such file or directory

最佳答案

不支持动态包含:

We don't support "Dynamic Include". There are lots of issues people have opened about this. It's really complex to implement and not actually nearly as useful as people think it would be.

https://github.com/pugjs/pug/issues/2622#issuecomment-270157667

关于javascript - jade/pug 是否可以在 include 语句中使用变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37094986/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com