alanshaw / grunt-include-replace

Grunt task to include files and replace variables. Allows for parameterised includes.
MIT License
200 stars 45 forks source link

Recursive replace #19

Closed XhmikosR closed 11 years ago

XhmikosR commented 11 years ago

Hi.

Is there any workaround so that the replace happens recursively? Or can you consider adding such an option?

Thanks.

alanshaw commented 11 years ago

Probably not, I think that would make it a little difficult to reason about what the output of the task would be. What is your use case?

Interestingly, because includes are processed after replaces you can do fun stuff like replace a variable with an include directive, but I wouldn't recommend it.

XhmikosR commented 11 years ago

The problem is that we use Sphinx to generate our site and we have a subdirectory with an index.html to each subdirectory.

I can specify the subdirectories but it would be much more handy if there was a recursive option.

alanshaw commented 11 years ago

Not sure I understand the problem, could you point me at some code or illustrate it somehow?

XhmikosR commented 11 years ago

Imagine this

index.html foo/index.html bar/index.html ...

alanshaw commented 11 years ago

Wouldn't a **/index.html in your src glob reach all of these?

XhmikosR commented 11 years ago

Thanks for the suggestion I will try it later when I'm home.

XhmikosR commented 11 years ago

@alanshaw: your solution indeed works fine!

I'll close the issue, but perhaps you could put this info in the docs.