[英]how to remove all comments in production branch
我有兩個環境:主分支和生產分支。 問題是我在每一行代碼中都有很多注釋,我想在生產分支中刪除它們。 我嘗試手動清理評論以進行生產,但是在主分支中進行一些更改並合並到生產后,所有評論都回來了。 有沒有辦法刪除生產分支中的所有評論?
嘿,如果你使用的是 babel cli,你可以通過 update.babelrc 配置刪除評論
{comments: false}
或者你可以在構建時像這樣傳遞它
"build": "babel ./index.js --out-dir ./dist/index.js --no-comments"
如果你想使用 gulp
你可以使用 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'));
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.