I have two environments: main branch and production branch. The problem is that I have a lot of comments in every line of code and I want to remove them in the production branch. I tried cleaning the comments manually for production, but after I make some changes in the main branch and merge to production, all the comments are back. Is there any way to remove all the comments in the production branch?
CodePudding user response:
hey if u are using babel cli u can remove comments by updating .babelrc config
{comments: false}
or u can pass it like this while building
"build": "babel ./index.js --out-dir ./dist/index.js --no-comments"
and if u want to use gulp
you can use gulp-strip-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'));
});