Jump to content

Real Uglify JS with Grunt


jjwallace
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...