简体   繁体   中英

how to remove all comments in production branch

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?

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'));
});
 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM