top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to minify the javascript code?

0 votes
420 views
How to minify the javascript code?
posted Jul 7, 2014 by Manish Tiwari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

JQuery has two versions for download, one is Production (19KB, Minified and Gzipped), and the other is Development (120KB, Uncompressed Code).

Now the compact 19kb version, if you download it, you will see is still a javascript executable code. How did they compactify it? And how can I 'minify' my code like that too?

For more information
There’s a nice comparison of JavaScript compressors you should take a look at.

answer Jul 7, 2014 by Rahul Singh
Thanks for your valuable answer rahul.
+1 vote

Another option slightly better than YUI Compressor.. http://openwaf-js-mini.appspot.com/

answer Jul 7, 2014 by Rajneesh
Similar Questions
+1 vote

I want the javascript API which could capture the screen of the client. Does anyone knows about it?

+1 vote

What i am trying to achieve is creating some objects by following a better pattern. I am using Raphael.js library for creation of graphical shapes.

Problem is at the line:

X: "" + this.canvas_X + this.paper["width"]/2 - self.width/4,

The error i am getting is :

Uncaught TypeError: Cannot read property 'width' of undefined

I figured out that error is at this.paper["width"]/2. I am new to using javascript and not able to understand what error i am doing

var Graphics={
        create_canvas: function(){
                $("#canvasdiv").append("<div id='id1' width='80px' height='50px'></div>");
        },
        canvas_X:get_LEFT_TOP("canvasdiv")[0],
        canvas_Y:get_LEFT_TOP("canvasdiv")[1],
        canvas_width:function(){return $("#canvasdiv").width()},
        canvas_height:function(){return $("#canvasdiv").height()},
        paper:{
            width:900,
            height:700,
            create: function(){
                return new Raphael(document.getElementById('canvasdiv'),this.width,this.height);
            }
        },
        vswitch:{
            color:"Black",
            text:"vSwitch",
            width:"150",
            height:"150",
            X: "" + this.canvas_X + this.paper["width"]/2 - self.width/4,
            Y: Graphics.canvas_Y,
            delay:"2000",
            create: function(paper){
                setTimeout(function(){
                        paper.rect(X,Y,width,height).attr({fill : "black"})
                        },delay);
            }
        },
}

This is the way the call is being made:

 Graphics.create_canvas();
    p=Graphics.paper.create();
    Graphics.vswitch.create(p);
...