Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove comments without uglifying in gulp?

Tags:

gulp

I want to remove comments, but not uglify the code. Is it possible with gulp? Or is this something that requires bower or something else?

like image 521
Rolando Avatar asked Sep 29 '22 01:09

Rolando


1 Answers

Yes, it is possible. For future reference, you should be using the gulp plugin registry. Doing a quick search for 'comments' found this:

var gulp = require('gulp');
var strip = require('gulp-strip-comments');

gulp.task('default', function () {
  return gulp.src('template.js')
    .pipe(strip())
    .pipe(gulp.dest('dist'));
});

https://github.com/RnbWd/gulp-strip-comments

like image 181
Ben Avatar answered Oct 04 '22 04:10

Ben