In production environments, mobile devices, etc. reduce size of our JS code is a must in order get a better usability, lower wait time when there is a poor bandwidth.

Another reason which we need to reduce code is to “protect” non free code (for example a private B2C, B2E, B2B portal).

A good example could be YUI Compressor. This tool, developed by Yahoo Team, reduces / compresses JS code:

YUI Compressor

Step by step

1. Download YUI Compressor tool from YUI Compressor

2. Use YUI on console. In this example (JS Bin – Collaborative JavaScript Debugging) we reduce this JS example:

Open a console and execute this command (-v in order to see WARNINGs or ERRORs, -o is the output file parameter)

 java -jar yuicompressor-2.4.8.jar -v myview.view.js -o myview.view-min.js 

This is the original code:

 sap.ui.jsfragment("fragment.Table", {   createContent : function(oController) {       //Obtain data from controller     var aData =;       //Create an instance of the table control     var oTable = new sap.ui.table.Table( {       title : oController.fragmentInitData.title, //Obtain title from controller       visibleRowCount : 7     });       //Obtain column definition from controller     for ( var i = 0; i 

3. A minimized file is created (we can see how size is reduced from 9k to 5k, WoW):

JS Bin – Collaborative JavaScript Debugging

 sap.ui.jsfragment("fragment.Table",{createContent:function(c){var;var a=new sap.ui.table.Table({title:c.fragmentInitData.title,visibleRowCount:7});for(var d=0;d

4. Let’s use new minimized file:




New NetWeaver Information at

Very Helpfull

User Rating: Be the first one !