Javascript has suddenly matured and perhaps these are its best of times. There is a large number of JavaScript libraries vying for your attention and capture your heart. Review the article describing the various libraries on Wikipedia.
It all really started with the introduction of Dynamic HTML[DHTML] when Javascript provided the scripting ability to interact with the web page which had remained mostly static till that time. With the support of CSS and Javascript the stage was set for the web pages to take the users to the next level. The next big push came in with the introduction of AJAX. The concurrent effort by developers to somehow address the display disparity with the existing browsers and make the user experience uniform across different existing browsers and versions resulted in packaging the various libraries. Of course Microsoft Visual Studio also worked hard on making this uniform user experience across browsers a priority and the applications developed using this IDE fulfilled this wish mostly.
Most recently Google made available its toolset, the Closure Compiler. It is supposed to make Javascript to download and run faster according to Google. It is more like a refactoring tool for Javascript. It also checks for script coding errors etc. Moreover it is integrated with Firefox's PageSpeed and you can see for yourselves the gain in performance using the Google Tool. The tool can be used from command line as well as a simple web application.
The above Google URL also has links to examples of the tool's usage. One such example shows optimizing code by removing white spaces. Review this example here.
In the above example, it took in the script shown here:
---------
function hello(name){
//Greets the user
alert('Hello, ' + name);
}
hello('New User');
------------------------
and the Closure Tool optimized it to the following after removing white spaces (as well as the comments) :
-----------
function hello(name){alert"Hello, "+name)}hello("New User");
------------------------------------------------
Parse errors with line number and character position are provided by the tool but you will have to go and count those on your input code. Also there is no color coding or error position highlighting.
How to access the Closure compiler?
Click on this URL and you are ready, set and go.
Edited in 2018:
Try this link for an ad free tool:
https://www.websiteplanet.com/webtools/jscssminifier/
.
It all really started with the introduction of Dynamic HTML[DHTML] when Javascript provided the scripting ability to interact with the web page which had remained mostly static till that time. With the support of CSS and Javascript the stage was set for the web pages to take the users to the next level. The next big push came in with the introduction of AJAX. The concurrent effort by developers to somehow address the display disparity with the existing browsers and make the user experience uniform across different existing browsers and versions resulted in packaging the various libraries. Of course Microsoft Visual Studio also worked hard on making this uniform user experience across browsers a priority and the applications developed using this IDE fulfilled this wish mostly.
Most recently Google made available its toolset, the Closure Compiler. It is supposed to make Javascript to download and run faster according to Google. It is more like a refactoring tool for Javascript. It also checks for script coding errors etc. Moreover it is integrated with Firefox's PageSpeed and you can see for yourselves the gain in performance using the Google Tool. The tool can be used from command line as well as a simple web application.
The above Google URL also has links to examples of the tool's usage. One such example shows optimizing code by removing white spaces. Review this example here.
In the above example, it took in the script shown here:
---------
function hello(name){
//Greets the user
alert('Hello, ' + name);
}
hello('New User');
------------------------
and the Closure Tool optimized it to the following after removing white spaces (as well as the comments) :
-----------
function hello(name){alert"Hello, "+name)}hello("New User");
------------------------------------------------
Parse errors with line number and character position are provided by the tool but you will have to go and count those on your input code. Also there is no color coding or error position highlighting.
How to access the Closure compiler?
Click on this URL and you are ready, set and go.
Edited in 2018:
Try this link for an ad free tool:
https://www.websiteplanet.com/webtools/jscssminifier/
.
No comments:
Post a Comment