最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jadepug Is it possible to use variables on include statement? - Stack Overflow

programmeradmin2浏览0评论

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

include ../mixins/root.pug

...but is it possible to use variables on include?

None of these work:

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

Result is this:

Error: ENOENT: no such file or directory

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

include ../mixins/root.pug

...but is it possible to use variables on include?

None of these work:

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

Result is this:

Error: ENOENT: no such file or directory
Share edited May 8, 2016 at 0:45 Feathercrown 2,5911 gold badge18 silver badges31 bronze badges asked May 8, 2016 at 0:24 Esa HannilaEsa Hannila 1,3182 gold badges16 silver badges34 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

Dynamic includes are not supported:

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

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

发布评论

评论列表(0)

  1. 暂无评论