From 12c7dedeb9ba4c9c6f34fb668f90bd230c046ec5 Mon Sep 17 00:00:00 2001 From: Artem S Vybornov Date: Wed, 25 Mar 2015 13:52:36 +0300 Subject: [PATCH] Fix #303: better options handling --- tasks/lib/uglify.js | 9 +++++++++ tasks/uglify.js | 5 ----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tasks/lib/uglify.js b/tasks/lib/uglify.js index 483bbd6f..9de436d7 100644 --- a/tasks/lib/uglify.js +++ b/tasks/lib/uglify.js @@ -83,6 +83,9 @@ exports.init = function(grunt) { if (options.compress.warnings !== true) { options.compress.warnings = false; } + if (options.screwIE8) { + options.compress.screw_ie8 = true; + } var compressor = UglifyJS.Compressor(options.compress); topLevel = topLevel.transform(compressor); @@ -91,6 +94,12 @@ exports.init = function(grunt) { } if (options.mangle !== false) { + if (options.mangle === true) { + options.mangle = {}; + } + if (options.screwIE8) { + options.mangle.screw_ie8 = true; + } // disabled due to: // 1) preserve stable name mangling // 2) it increases gzipped file size, see https://github.com/mishoo/UglifyJS2#mangler-options diff --git a/tasks/uglify.js b/tasks/uglify.js index 019144cb..1e841879 100644 --- a/tasks/uglify.js +++ b/tasks/uglify.js @@ -131,11 +131,6 @@ module.exports = function(grunt) { options.destToSourceMap = destToSourceMapPath + sourceMapBasename; } - if (options.screwIE8) { - if (options.mangle) { options.mangle.screw_ie8 = true; } - if (options.compress) { options.compress.screw_ie8 = true; } - } - // Minify files, warn and fail on error. var result; try {