Is there is way to press JavaScript code?
e.g.
function test(){
// some code here
}
after pression it should be
function test(){//some code here}
Also, I need vise versa at the time of editing the code.
Is there is way to press JavaScript code?
e.g.
function test(){
// some code here
}
after pression it should be
function test(){//some code here}
Also, I need vise versa at the time of editing the code.
Share Improve this question edited Mar 26, 2010 at 2:36 Crescent Fresh 117k27 gold badges157 silver badges140 bronze badges asked Jan 29, 2010 at 5:09 VickyVicky 9,57516 gold badges73 silver badges91 bronze badges7 Answers
Reset to default 6You can use a javascript minifier.
YUI Compressor
JS Minifier
jsCompress
There are a number of tools available that can reduce the download size of your javascript, improving first-load performance. The general technique of making syntactic changes to your javascript, without changing its structure, is called minification; and the tools are minifiers. I know Google has an excellent tool, as does Yahoo - there are probably others as well. Check the other responses here for links.
For more resources, try this search:
http://www.bing./search?q=javascript+minify
Some other things to keep in mind when optimizing your javascript:
You'll want an option to download non-minified javascript, at least on your test site - debugging minified javascript is a major pain.
Configure your web server to also press (gzip) your javascript if the client includes the appropriate 'accept' header in their request.
Make sure you configure our cache settings for your javascript so that browsers can use their locally cached version without even sending a server request, if the file is already previously downloaded.
Minified Javascript
http://www.google./#hl=en&q=minified+javascript&fp=64df356c6a3f8304
http://www.minifyjavascript./
http://developer.yahoo./yui/pressor/
Good answers, for jquery you have a pressed version, remove the ments in the header to save some octets. For your own files, use the YUI pressor, i think it's the best.
I would add if you want to save some time, you can also put all your Javascripts files in one, so you will save some precious time with http request (only for production though).
There is already a pressed version of jQuery for you to use. For js you write yourself any of the other tools mentioned will work, I use YUI myself.
A good way to optimize your site is to include one javascript file for all. An article that explains the process of Javascript Bootstrapping can be found here.
Once you use the available pressors above, you should implement this so that your site run quicker.Hopefully this will help.
Use JSMIn its the best.