1

我正在使用guard-concat 插件来连接我的车把模板文件。

我可以使用正则表达式来连接一个文件夹中的所有文件,而不是输入所有文件的名称吗?

所以不要这样做:

guard :concat, type: "php", files: %w(a b b/c b/d), input_dir: "app/views/handlebars",     output: "app/views/handlebars/all"

我可以这样做:

guard :concat, type: "php", files: %r{.+}, input_dir: "app/views/handlebars", output: "app/views/handlebars/all"

当我这样做时,我收到以下错误:

ERROR - Invalid Guardfile, original error is: > [#] undefined method `join' for /.+/:Regexp
4

2 回答 2

0

Francesco Canessa(负责守卫连接)告诉我

我可以实现此功能,但通常文件顺序对于 CSS 和 JS 都很重要(例如对于需要首先加载库的代码)

所以这在今天是不可能的,但可能会在未来的版本中添加。

链接到guard-concat github页面上的问题

于 2013-04-18T08:43:26.000 回答
0

您可以使用Dir#glob(或别名Dir#[]):

Dir['*/**.php']

作为论据。它将返回包含所有.php子文件夹中所有扩展名的文件的数组。

于 2013-04-18T08:54:42.670 回答