繁体   English   中英

从NPM(节点模块)解析nunjucks模板?

[英]Resolving nunjucks templates from NPM ( node modules )?

寻找一种方法来从NPM node_modules文件夹中解析/导入node_modules

例如,假设我们安装了这样的软件包:

npm i -S @example/cards

现在,我们要在模板中像这样从中导入:

{% import "@example/templates/birthday.html" as birthday %}

有什么想法吗?

正如@Aikon Mogwai所指出的,这可以解决问题:

nunjucks.configure('node_modules');

如果有人要参考实现,我已经在@ superflycss / cli中实现了它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM