浏览代码

Maintain Copyright statements in minified code

Alex Dima 8 年之前
父节点
当前提交
d4c12fde31
共有 1 个文件被更改,包括 15 次插入1 次删除
  1. 15 1
      gulpfile.js

+ 15 - 1
gulpfile.js

@@ -96,7 +96,21 @@ gulp.task('release', ['clean-release','compile'], function() {
 		}))
 		.pipe(gulp.dest('./release/dev'))
 		.pipe(uglify({
-			preserveComments: 'some'
+			preserveComments: function(node, token) {
+				var text = token.value;
+				if (text.indexOf('monaco-html version') >= 0) {
+					// this is the main copyright header
+					return true;
+				}
+				if (text.indexOf('Copyright (c) Microsoft') >= 0) {
+					// this is another Microsoft copyright header (not the main)
+					return false;
+				}
+				if (/copyright/i.test(text)) {
+					return true;
+				}
+				return false;
+			}
 		}))
 		.pipe(gulp.dest('./release/min')),
 		gulp.src('src/monaco.d.ts').pipe(gulp.dest('./release/min'))