From b7b3eeb143d05232008a5f77503f051dc06dff6f Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 4 May 2021 13:40:35 +0200 Subject: [PATCH] Do not change function and class names when minifying JS (#10223) --- src/Umbraco.Web.UI.Client/gulp/tasks/js.js | 7 ++++++- src/Umbraco.Web.UI.Client/gulp/util/processJs.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/gulp/tasks/js.js b/src/Umbraco.Web.UI.Client/gulp/tasks/js.js index bab6239a09..bfe02e858e 100644 --- a/src/Umbraco.Web.UI.Client/gulp/tasks/js.js +++ b/src/Umbraco.Web.UI.Client/gulp/tasks/js.js @@ -19,12 +19,17 @@ function js() { var stream = new MergeStream(); var task = gulp.src(config.sources.globs.js); + // NOTE: if you change something here, you probably also need to change it in the processJs util if (config.compile.current.minify === true) { task = task.pipe( minify({ noSource: true, ext: { min: '.min.js' }, - mangle: false + mangle: false, + compress: { + keep_classnames: true, + keep_fnames: true + } }) ); } else { diff --git a/src/Umbraco.Web.UI.Client/gulp/util/processJs.js b/src/Umbraco.Web.UI.Client/gulp/util/processJs.js index e0bff8827f..98b1c23343 100644 --- a/src/Umbraco.Web.UI.Client/gulp/util/processJs.js +++ b/src/Umbraco.Web.UI.Client/gulp/util/processJs.js @@ -36,12 +36,17 @@ module.exports = function (files, out) { task = task.pipe(concat(out)).pipe(wrap('(function(){\n%= body %\n})();')) + // NOTE: if you change something here, you probably also need to change it in the js task if (config.compile.current.minify === true) { task = task.pipe( minify({ noSource:true, ext: {min:'.min.js'}, - mangle: false + mangle: false, + compress: { + keep_classnames: true, + keep_fnames: true + } }) ); } else {