如何在不丑化 gulp 的情况下删除评论?
How to remove comments without uglifying in gulp?
我想删除评论,但不想丑化代码。 gulp有可能吗?还是这需要 bower 或其他东西?
是的,这是可能的。为了将来参考,您应该使用 gulp plugin registry。快速搜索 'comments' 发现了这个:
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'));
});
我想删除评论,但不想丑化代码。 gulp有可能吗?还是这需要 bower 或其他东西?
是的,这是可能的。为了将来参考,您应该使用 gulp plugin registry。快速搜索 'comments' 发现了这个:
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'));
});