New to site? Create an Account


Login

Lost password? (close)

7 Minify JS and CSS

You should make use of minified files (and minify JS and CSS) as these files tend to have less size then regular files. Minifying eliminates extra blank spaces, line breaks, and removes comments and indentation in your code that results into a reduction of the file size. It also shortens variable names thus reducing download time for your JavaScript files. There are many online tools available to minify javascript and CSS files. Replace your regular JS and CSS code with minified code. There are lots of websites available online which converts JS and CSS in minified format.

If possible include all javascript code in one file and all style sheet code in single file. This will make it load all at once which will make site loading a little bit faster.

minify

The sole benefit of minified JavaScript code is allowing a client to download fewer bytes, enabling the page to load faster.

Minification is NOT like normal data compression

Normally when you think of data compression, one of the first things that may come to mind is “zipping” a file. When you zip a file, you are compressing it using a special algorithm. When someone else has to unzip that file, they have to decompress the file using a special program (which you may have used without knowing it since it comes with most operating systems built in).

However, with Javascript minification, no special program is needed by the browser in order to understand how to read the minified Javascript – because minified Javascript is still readable by the browser as is. A human can even read it – although with great difficulty since there won’t be any whitespace and newline characters. But, the point is that no intermediate program is needed in order to convert the minified Javascript into a form that is readable by the browser, and for that reason it is very different from normal data compression.

Please click on number four to learn about the next step.

Share Button

Advertisement