Minifying JavaScript, CSS, and HTML

You can also improve the speed of your Web site through minifying —
making some of the files, like JavaScript, CSS, and HTML, smaller. This
involves taking all the files of your Web site and reducing the size by
doing things like
✦ Removing all line breaks and spaces in the file.
✦ Removing all code comments in the file.
✦ Removing unnecessary characters in the file.
✦ Using code shorthand, where possible, to decrease the amount of
characters in the file.
✦ Combining the files into one file, wherever possible; therefore, instead of
having ten JavaScript files, you could reduce the number to four or five.

Minifying JavaScript, CSS, and HTML files reduces the overall file size,
making them load faster on your Web site. Obviously, adjusting each of the
existing files on your site to make them smaller would take quite a lot of time
and programming skills that you may or may not possess. Therefore, you
may prefer to use a plugin or program to adjust these files. A good plugin or
program used to minify files can reduce the file to 30–40 percent of its original
size, which greatly improves the response time of your Web site.

 

Use a WordPress plugin (such as W3 Total Cache (http://wordpress.org/
extend/plugins/w3-total-cache) that has a feature that minifies files,
such as JavaScript, CSS, and HTML, by caching the minified files. This leaves
the original files intact so they are easily readable and editable by you.

Advertisements
Minifying JavaScript, CSS, and HTML

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s