Samiksha Hiwase | 7 Min Read | June 30, 2020
If the speed of page loading time on your site is slow it can turn away your customers on another site and affect the conversion rates. The process that can be used to improve your page loading time is beneficial building into your themes of the store. One such process is minification.
What is minification?
Minification can compress the text by removing extra characters like spaces and comments. In simple words, Minification is a process of removing unnecessary or redundant data without affecting how the resource is processed by the browser.
For example code comments and formatting, removing unused code, using shorter variable and function names, and so on. This method makes the file size smaller. If your all files are small in size it means they can get transfer faster, which leads to your site loads quickly.
Minification technique can reduce 10% – 95% the size of the code.
You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.
In the Asset folder, there is a total of 5 js files.
The sizes of files before minimizing are dependent on how many files are used in the theme and which files are to be minified.
The size of the file before minimizing is larger let’s say 200 kb then after minimizing the size of the same file becomes 88 kb. In simple words, the file size gets reduced after minimizing.
- By removing newline characters and white space.
- By trying to arrays to objects
- By shortening variable names
- By removing comments
- By optimizing conditional statements
Minification has become a standard process for page speed optimization.
- Faster download times for your users.
- Less bandwidth consumption of your website.
- Reducing the number of HTTP requests to your server, which in turn reduces the load on the server and allows more visitors to access your website.