Skip to content

Instantly share code, notes, and snippets.

@arian
Created December 28, 2012 14:22
Show Gist options
  • Save arian/4398268 to your computer and use it in GitHub Desktop.
Save arian/4398268 to your computer and use it in GitHub Desktop.
compression and replacing vars/consts
//arian@arian-sys:~/www/wrapup (master) $ ./node_modules/.bin/uglifyjs test.js --compress --mangle --define ES5=false
//WARN: Condition always true [test.js:6,34]
//WARN: Dropping unreachable code [test.js:9,2]
function foo(){console.log("es5")}
function foo(){
const ES5 = true
if (typeof ES5 != 'undefined' && ES5)
console.log('es5')
else
console.log('not es5')
}
// arian@arian-sys:~/www/wrapup (master) $ ./node_modules/.bin/uglifyjs test.js --compress --mangle --define ES5=false
function foo(){var o=!0;o!==void 0&&o?console.log("es5"):console.log("not es5")}
function foo(){
var ES5 = true
if (typeof ES5 != 'undefined' && ES5)
console.log('es5')
else
console.log('not es5')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment