JavaScript optimization - build process

My project has big amount of classes interacts on client side. Each class placed into separate .js file. It’s very useful for maintenance. Good practice for speed page load is reducing amount of client requests to server. So than less images and other files included on the page than faster it loads. In case of images - CSS sprites can help to reduce count of requests. For js and css files - concatenation and compression. We will talk about it

Very useful open source tool js-builder

js-builder

Excellent tool to create file concatenation order. Works with any file extension. Also compresses files (very little compression).

In my project I use prototype.js library. When builder compresses prototype.js he breaks with exception. So I downloaded sources of it and rebuilds. So now builder only does concatenation without compression. You can download dll from my build and place it into directory with JSBuilder.exe

Builder also has console application. It’s exactly what we need for build.

Now we need to do file compression with output of js-builder.

For this purpose I used YUI Compressor. Excellent library with high level of minification.

Now we bring all together and make assembly process. To do this I created batch file. (I’m one of the windows users) . It looks like this (build.bat)

In my case js-builder outputs 2 files - css amd js, then compressor minifies them. Hope this helps you to create yours building process. Russian version

Comments

Checked, realy good optimized. And don`t remember remove debuggers from code because not billd.

You can use simple HTML-formatting tags(like <b>, <ul>, <code> and others)