N
N
nonamich2017-07-11 12:42:10
JavaScript
nonamich, 2017-07-11 12:42:10

Catching the gulp file?

How to properly catch files and apply modules to them?

gulp.task("production", function(){
  return gulp.src("app/**")
  .on("data", function(file){
    if(file.path.search(".html") != -1){
      file
        .pipe(gulpRemoveHtml())
        .pipe(insertLines({
            'before': /<\/body>$/,
            'lineBefore': '<script type="text/javascript" src="cordova.js"></script>'
          }));
    }
  })
  .pipe( gulp.dest("dist/production") );
});

Mistake!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dark Hole, 2017-07-11
@abyrkov

gulp-filter will help you .
But in general, this is a bad idea.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question