From d4c12fde31286c84fd421e7ed278f4fad4b4c964 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 18 Jan 2017 16:11:46 +0100 Subject: [PATCH] Maintain Copyright statements in minified code --- gulpfile.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 6993e43d..7f35c9a7 100644 --- a/gulpfile.js +++ b/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'))