What Is Minification?
The process of reducing the size of files like HTML files, cascading style sheets or Javascript is called minification. It is done by eliminating things that are not required by browsers to use files. The main aim is to make the source code of a page small.
White spaces are one such thing that can be eliminated from the code of a site to make it smaller. Some web programmers add blank lines and spaces in their code to make it easy to read. These white spaces are meaningless to search engines and web browsers. Hence, these lines get ignored by the search engines. These white lines and blank spaces increase the file size and removing them from the source code of a site can make the file size much smaller.
How is it different from compression?
At the concept level, minification may be similar to compression of a file. Both these things aim to reduce the size of the file. However, these two are not the same thing. The main difference is that compressed files need to be decompressed first before opening them. However, when a source code is minified, there may be no need to decompress the files.
What are the things that can be minified?
Minification works best for languages like JavaScript. Besides this, it can also be used to reduce the size of HTML files, Cascading Style Sheets, etc.
Tools
JavaScript code optimizers like JSMin and Packer. These tools preserve conditional comments when they minify the source code of a JavaScript.
Closure Compiler which is a tool released by Google. This tool can remove dead code, do aggressive naming and function inlining.
Microsoft Ajax Minifier, Yahoo! YUI Compressor and Pretty Diff that help to minify the source code of CSS files
minifyPS which is a PowerShell script that reduces the size of PowerShell scripts and JavaScript files.
Advantages
Reduces file transfers
The main purpose of file transfers is to reduce the size of files. The size of the files can be reduced significantly depending on the size of the original file.
Reduces page load time
Since big files take a lot of time to load, minification can help to reduce the page load time considerably. As a result, the bandwidth used to transfer files will also be reduced.
Improves user experience
Nobody likes to wait long for a page to load. Reducing the page load leads to better user experience.
Improved organic search performance
Search engines prefer websites that load fast and promote sites that are liked by users. Since minification helps you to reduce your page load time and improve user experience, your site will be liked by search engines as well.
Less server space required
If your website is large, minifying the code will mean that you need lesser server space to host your site.
There really is no reason for not minifying the source code of your site. Since we live in a competitive world, even the smallest change that you make to your website can have a great impact on its performance. A good professional web design company will encourage the minification of the sites source code so that your site can get maximum benefits from it.
White spaces are one such thing that can be eliminated from the code of a site to make it smaller. Some web programmers add blank lines and spaces in their code to make it easy to read. These white spaces are meaningless to search engines and web browsers. Hence, these lines get ignored by the search engines. These white lines and blank spaces increase the file size and removing them from the source code of a site can make the file size much smaller.
How is it different from compression?
At the concept level, minification may be similar to compression of a file. Both these things aim to reduce the size of the file. However, these two are not the same thing. The main difference is that compressed files need to be decompressed first before opening them. However, when a source code is minified, there may be no need to decompress the files.
What are the things that can be minified?
Minification works best for languages like JavaScript. Besides this, it can also be used to reduce the size of HTML files, Cascading Style Sheets, etc.
Tools
JavaScript code optimizers like JSMin and Packer. These tools preserve conditional comments when they minify the source code of a JavaScript.
Closure Compiler which is a tool released by Google. This tool can remove dead code, do aggressive naming and function inlining.
Microsoft Ajax Minifier, Yahoo! YUI Compressor and Pretty Diff that help to minify the source code of CSS files
minifyPS which is a PowerShell script that reduces the size of PowerShell scripts and JavaScript files.
Advantages
Reduces file transfers
The main purpose of file transfers is to reduce the size of files. The size of the files can be reduced significantly depending on the size of the original file.
Reduces page load time
Since big files take a lot of time to load, minification can help to reduce the page load time considerably. As a result, the bandwidth used to transfer files will also be reduced.
Improves user experience
Nobody likes to wait long for a page to load. Reducing the page load leads to better user experience.
Improved organic search performance
Search engines prefer websites that load fast and promote sites that are liked by users. Since minification helps you to reduce your page load time and improve user experience, your site will be liked by search engines as well.
Less server space required
If your website is large, minifying the code will mean that you need lesser server space to host your site.
There really is no reason for not minifying the source code of your site. Since we live in a competitive world, even the smallest change that you make to your website can have a great impact on its performance. A good professional web design company will encourage the minification of the sites source code so that your site can get maximum benefits from it.
Source...