• View our reviews on Hot Scripts
  • JS Tutorial

Recent Comments

Powered by Disqus

Back to articles

Javascript packing

You know why you should minify your javascript and CSS files. Files will take less space and they will download faster, thus making your website load faster. But what about javascript packing? What is the difference and do I need it?

Well, idea javascript packing is similar to minifying, only it is more complex then just removing spaces and comments. Your javascript code gets examined as string, allmost all variables are renamed to shorter ones and additionally you can convert this string to 64 base, maeking it much smaller. Then you wrap it into unpacking function and pass to eval function to run it.

Advantages: Your javascript is much smaller, then it would be with simple minification, thus it loads faster. Unpacking is done quickly without almost any delay. And packing obfusticates your code, makes it unreadable and uneditable (without some tools).

Disadvantages: Well, as all code is obfusticated, you'll have to maintain real unpacked version to make modifications in code and pack it again. And you'll have to use more strict syntax for your javascript codes. No skipping semicolons ";" for some lines, etc.

How to do it? Well best way I found is provided by Dean Edwards (who is an author of javascript packing) and he provides free and easy way to do it on his website: and also scripts for different languages for javascript packing.

You may also be interested in:

Powered by

blog comments powered by Disqus