Skip to content

Commit

Permalink
Fix #303: better options handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vibornoff committed Mar 25, 2015
1 parent 8f9bb92 commit 12c7ded
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 9 additions & 0 deletions tasks/lib/uglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions tasks/uglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 12c7ded

Please sign in to comment.