jjwallace Posted May 28, 2017 Share Posted May 28, 2017 Hey guys, i did uglify on some games inthe past and got the most discusting code over. I now use Grunt concat and uglify but the code isnt ugliy enough. Any suggestions? x2F","\x6F\x70\x65\x6E","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x74\x68\x65\x73\x65\x78\x67\x61\x6D\x65\x2E\x63\x6F\x6D\x2F","\x6D\x75\x74\x65","\x70\x6C\x61\x79\x62\x61\x63\x6B\x52\x61\x74\x65"];BasicGame[_0x4f44[0]]=function(_0x2f67x1){this[_0x4f44[1]]=null;this[_0x4f44[2]];this[_0x4f44[3]];this[_0x4f44[4]];this[_0x4f44[5]];this[_0x4f44[6]];this[_0x4f44[7]];this[_0x4f44[8]];this[_0x4f44[9]];this[_0x4f44[10]];this[_0x4f44[11]];this[_0x4f44[12]];this[_0x4f44[13]];this[_0x4f44[14]];this[_0x4f44[15]];this[_0x4f44[16]];this[_0x4f44[17]];};var scnQuestion= new Array();var scnQuestionBeat= new Array();var scnAnswer1= new Array();var scnAnswer2= new Array();var scnAnswer3= new Array();var scnAnswer4= new Array();var scnAction1= new Array();var Link to comment Share on other sites More sharing options...
Jammy Posted May 28, 2017 Share Posted May 28, 2017 Possibly use toplevel option on uglify https://stackoverflow.com/questions/21003890/uglifyjs-2-api-equivalent-for-cli-m-toplevel Link to comment Share on other sites More sharing options...
alex_h Posted May 29, 2017 Share Posted May 29, 2017 Uglify JS takes various parameters that determine in what ways it will modify your code: https://github.com/mishoo/UglifyJS2#command-line-options You should find most of these are accessible via the options you can set in your grunt config Link to comment Share on other sites More sharing options...
jjwallace Posted May 30, 2017 Author Share Posted May 30, 2017 Thanks Guys, you rock! @Jammy @alex_h Link to comment Share on other sites More sharing options...
jjwallace Posted May 30, 2017 Author Share Posted May 30, 2017 module.exports = function(grunt){ var gameName = 'game' // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { separator: ';', }, dist: { src: ['src/*.js'], dest: 'build/game.js', }, }, uglify: { my_target: { options: { mangle: { toplevel: true }, compress: true, ie_proof: false }, files: { 'build/game.min.js' : ['build/game.js'] } } }, watch:{ scripts: { files: ['src/*.js'], tasks: ['compile'], } } }); //GRUNT PLUGINS grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-watch'); //Concat and Uglify Task grunt.registerTask('compile', ['concat','uglify']); grunt.registerTask('both', function(){ console.log('I am Speaking.'); }); } Hmm, same result...... Link to comment Share on other sites More sharing options...
alex_h Posted May 31, 2017 Share Posted May 31, 2017 Try changing it to uglify: { options: { mangle: true }, my_target: { files: { 'build/game.min.js' : ['build/game.js'] } } } Link to comment Share on other sites More sharing options...
jjwallace Posted May 31, 2017 Author Share Posted May 31, 2017 Alex_h, moving options outside target worked! thanks Link to comment Share on other sites More sharing options...
Recommended Posts