When we develop our websites, we often leave white space and comments in our code so humans can easily read and understand it. However, when the code file is being executed on our devices, excess white spaces and comments no longer convey a meaning to humans. So, if we can remove the extra characters from our files, it will reduce our file size and enhance the performance of our website. There are many tools available out there that we can use to remove unnecessary characters (minify them) from our code.
In the preceding section, I discussed CSS preprocessors. Both SASS and LESS have CSS minifying options that developers can easily use. The main advantage of CSS preprocessor minification is that developers are never going to touch the CSS file and only work with .sass
or .less
. So, they can keep the white space and comments in their raw file and when compiling, all the unnecessary characters will be removed. Apart from that, there are many online...