Roots Discourse

Remove comment html with gulp

sage8

#1

Hi,
I want to remove the comment html:

I added
gulp.watch([’*.php’], [‘removeHtmlComments’]);
in watch, what I did wrong?

gulp.task('removeHtmlComments', function () {
  return gulp.src('*.php')
    .pipe(removeHtmlComments())
    .pipe(gulp.dest('.'))
    .pipe(browserSync.stream());
});

gulp.task('watch', function() {
  browserSync.init({
    files: ['{lib,templates}/**/*.php', '*.php'],
    proxy: config.devUrl,
    snippetOptions: {
      whitelist: ['/wp-admin/admin-ajax.php'],
      blacklist: ['/wp-admin/**']
    }
  });
  gulp.watch([path.source + 'styles/**/*'], ['styles']);
  gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts']);
  gulp.watch([path.source + 'fonts/**/*'], ['fonts']);
  gulp.watch([path.source + 'images/**/*'], ['images']);
  gulp.watch(['*.php'], ['removeHtmlComments']);
  gulp.watch(['bower.json', 'assets/manifest.json'], ['build']);
});