Skip to main content

Smaller is Better

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!

Comments

Anonymous said…
This is a pretty cool tool. I will use it to condense my files.

Popular posts from this blog

Adding custom Yahoo Store fields - Catalog Manager vs. Store Editor

In a non-legacy Yahoo Store, there are two ways to add custom fields: through Catalog Manager under "Manage my Tables" and through the Store Editor, under "Types" (the Store Editor's "Types" are essentially the same as Catalog Manager's "Tables".) Whether you add custom fields from Catalog Manager or from the Store Editor does make a difference as each has its advantages as well as disadvantages. Catalog Manager To me the main advantages of using Catalog Manager to add custom fields are: 1) You can add multiple fields quicker 2) You can later change the field's name and even type 3) You can delete the field if you no longer need it. 4) All the fields that are available in Catalog Manager are included in the data.csv file if you download your catalog. 5) All the fields that are available in Catalog Manager are also included in the catalog.xml datafeed file, which is used by the comparison shopping engines, for example. (See the Search ...

Multi-Add and Yahoo Floating Cart Blues

Although the Yahoo! Floating Cart is considered pretty much bug free by Yahoo (you can look at the official open issues list here http://help.yahoo.com/l/us/yahoo/smallbusiness/store/floatingcart/floatingcart-09.html ) , there are some pretty "interesting" issues still, so since I keep running into them, I decided to post them here along with the work-arounds. The following issues all occur with multi-add forms only. 1) If you have your quantity set up as anything other than a simple text box (for example a drop-down SELECT box), the floating cart will not take the quantity value. It will take vwquantity as a customer-selected option. The workaround: use a text box instead. Nothing else works currently. 2) If you have a script that checks if the shopper made a selection from a drop-down (basically, any kind of an "onsubmit" handler), the floating cart will still receive the item, even if you cancel the submit event. The workaround: put the event handler on the click...

Pre-Season Checkup

With the holiday shopping season fast approaching it's a good idea to do a general checkup on your store to be sure it's ready for prime time. Below are a few things you would want to check, along with a few add-ons that are not too major in scope, but which are often neglected and give you an edge over your competition. Can you Search and Order? Every time we do anything major in a store we test two things: whether searching and adding to cart/ordering works. You can have nice, flashy pictures, cool animation effects, a very quick loading site, anything, but if the store search is broken or you can't add to the cart or can't check out then an ecommerce site is worth nothing. Can you Order? Chances are if your checkout was completely broken you'd know about it by now, but it doesn't have to be totally broken in order to scare away potential customers. So go ahead, go to your site and first do a search and make sure it works. Then, add one or more products ...