【问题标题】:require all templates including files with underscores要求所有模板,包括带下划线的文件
【发布时间】:2013-04-25 13:54:23
【问题描述】:

使用早午餐,我可以要求像这样的文件夹中的所有文件

require('/templates/');

但这不包括带下划线的文件,我仍然需要像这样要求它们:

require('templates/_mood');

我如何要求模板文件夹中的所有文件,包括带下划线的文件?

【问题讨论】:

    标签: brunch


    【解决方案1】:

    tl;dr 你不能这么简单。

    require('/templates/'); 不会加载所有文件,而是默认加载templates/index 文件。在index 中,您可以要求当前目录中的所有文件,这样您的问题就会得到解决

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-10
      • 1970-01-01
      • 2013-05-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多