jade / pug是否可以在include语句中使用变量? [英] jade/pug Is it possible to use variables on include statement?

查看:650
本文介绍了jade / pug是否可以在include语句中使用变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发nodejs应用程序,我遇到了include语句的问题。
当我像这样使用它时有效:

I'm developing nodejs application and I have issue with include statement. It works when I use it like this:

include ../mixins/root.pug

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

...but is it possible to use variables on 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

这篇关于jade / pug是否可以在include语句中使用变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆