You often hear the phrase "bigger is better". Sometimes it's true but not when it comes to JavaScript or CSS code in your Yahoo! Store pages. If you include JavaScript code or CSS either as linked files (the preferred method) or embedded inside your pages (obviously not preferred), making these files as small as possible should be your goal. Why? This is no rocket science: smaller files mean faster page loads = happy customers.
Ok, so what bloats JavaScript code? In general, white space (tabs, carriage returns, non-used spaces), comments, and the actual code, such as variable and function names.
You have control over all of these, however, if you don't use white spaces, carriage returns or comments, it will be immensely difficult to understand and modify your code. And not just for others, you too.
There are many commercial JavaScript compression tools around, but I've been using this handy and free utility: http://www.andrewkesper.com/jscrush/
This little utility can take any number of JavaScript files and automatically remove white spaces and comments from those files resulting in files considerably smaller in size than the originals. There are a couple of other advantages of this tool:
1. You can use it to compress CSS files as well, not just JavaScript files.
2. You can have it combine your source JavaScript files into a single, compressed file.
Happy compressing!
Ok, so what bloats JavaScript code? In general, white space (tabs, carriage returns, non-used spaces), comments, and the actual code, such as variable and function names.
You have control over all of these, however, if you don't use white spaces, carriage returns or comments, it will be immensely difficult to understand and modify your code. And not just for others, you too.
There are many commercial JavaScript compression tools around, but I've been using this handy and free utility: http://www.andrewkesper.com/jscrush/
This little utility can take any number of JavaScript files and automatically remove white spaces and comments from those files resulting in files considerably smaller in size than the originals. There are a couple of other advantages of this tool:
1. You can use it to compress CSS files as well, not just JavaScript files.
2. You can have it combine your source JavaScript files into a single, compressed file.
Happy compressing!
Comments