Search code examples
node.jsgulpgulp-concat

Can gulp collect lines grep:ed into single output file?


I'm trying to filter out lines from all .js source files, and put into a separate file. (Specifically, I'm trying to grep all calls to a string translation function and post-process them).

I think I have the different parts figured out but can't make them fit together.

  1. For each file, process it
  2. Write each file's grep:ed lines to output.
  3. Append the result to a file

I've tried to through.push(<output per file>) from the plugin, but the following step expects a file, not a string.

From there, I expect I could do something like gulp-concat or stream merge on the results and pipe it on to gulp.dist, but there's bit missing here.


Solution

  • I figured out a way - simply replace the Vinyl file's content with the lines to output, and push that through to through.push.