Optimize JS in MovableType

| No Comments

Everyone knows my blog is powered by MovableType. Actually I start to blog from MovableType 3.11.

There is a mt.js file in root of the blog. It is 20K after generating by MovableType 4.26.

Then to make it smaller. I use Yuicompressor which is provided by Yahoo Developer Network.
Then it is only 13K. And also I use gzip compress facility on Apache server. It is 4.1k when transferring to Web Browser.
Actually before minifiy its gzip size is 5.8K.
So it is clear to make a list.
Original mt.js
20.2K, gzip version 5.8K
Minified mt.js
13.1K, gzip version 4.1K

It is another trick to optimize JS files. Especially when more than 2 js files have to be included in blog.

I combined all js files into one js file. Don't ask me how to combine it. Because I use the stupid way to combine them, just copy and paste.

Say I have five js files. Total 39K. After gzip, it is about 19K. When web page request them, five http request send out.
I put all js into one file, then only one http request needed.
And also I use minify tool to make it smaller.
After that, it is 30.5K, and gzip 14.6K. About 25% smaller.

OK I almost forget to mention one thing. To keep your mt.js minified version. Change mt.js publish to manually.



Leave a comment

About this Entry

This page contains a single entry by David Yin published on July 23, 2009 11:37 PM.

How to increase Yslow score from C to B at Dreamhost was the previous entry in this blog.

Another VOIP service provider - SmartVoip is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.02

Subscribe

Online Tools

Code Convertor