Search code examples
rubyguard

Can I use regular expressions with guard-concat?


I'm using the guard-concat plugin for guard to concatenate my handlebar template files.

Can I use regular expression to make it concat all files in one folder instead of typing in all the names of the files?

so instead of doing this:

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

I could do this:

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

When I do that I get the following error:

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

Solution

  • Francesco Canessa (responsible for guard-concat) has told me

    I can implement this feature but usually the files order is important both for CSS and JS (for example for code that needs libraries to be loaded first)

    So this is not possible today but might be added in future releases.

    link to the issue on guard-concat github page