Minify Resources
What does it mean to minify resources?
Minification is a process using which you can optimize your website. It refers to the process of reducing the data in a resource or element without affecting how the resource renders or behaves on the browser at the user's end. An example of this would be to use shorter names for variables or removing unnecessary or unused code.
Why minify resources?
Minifying resources is not the same as compression. When files are compressed, they must be decompressed before they can be run. Minified resources, on the other hand, can be run as-it-is.
How to minify resources?
- To minify CSS, you can try HTMLMinifier
- To minify HTML, you can use csso and CSSNano
- To minify Javascript, you can opt for UglifyJS.
You can also minify resources manually, although this is not recommended since it can introduce errors and break your code.
To minify resources follow these steps:
- Remove the comments from the code. Comments are text contained within and including /**/
- Remove all the extra spaces. Once you remove all the unnecessary spaces, you will see the code appear in a single line.
Plugins are also available that will minify resources automatically. The use of such plugins will eliminate the need for any manual steps.
Keep Learning more from our Learn Technical SEO guides. Do Technical SEO Audit yourself for free here.