I just wanted to mention some of the cool JS tools I came across:

  • *Google Closure Compiler - Use this to minify or prettify(unminify) any javascript. It can also reoptimize your javascript with variable renaming etc.

Here’s an example of code I unminified(js from facebook): Before

function ChatOptions(a,b){this._jslog=JSLogger.create('chat_options');this._jslog.log('server',{vis:a});this.visibility=!!a;this._lastVisibilityChangeTime=0;this.settings=b;}

After

function ChatOptions(b, a) {
  this._jslog = JSLogger.create("chat_options");
  this._jslog.log("server", {vis:b});
  this.visibility = !!b;
  this._lastVisibilityChangeTime = 0;
  this.settings = a
}

Note that the compiler even rearranged the arguments list. Similarly you can compress javascript code using Clojure, which generates logically same code, however it will be more optimized for saving space. Google has provided full api for clojure compiler which you can see *here

  • JSFiddle : This is an online environment where you cam create HTML, JS and play around with it. It even supports adding jQuery, prototype and other popular js libraries. What’s even more cool ? You can even save the snippets and share with other people, just likePastebin or *Github Gist. They also have great examples you can see to get started.

So have fun and happy coding :)



blog comments powered by Disqus