![]() CompressionĬompression makes a file smaller, it can make a big difference in text files. We can also minify this, using an HTML minifier. Often you can see there are CSS and Javascript mixed with the HTML. Often HTML pages have inline CSS and inline JS. The last file we will look at minifying is the HTML itself. Here we can see that minifying the CSS has made a saving of 33KB, the file has gone from 100KB to 67KB. ![]() To do that copy the CSS and paste the css into the window to minify. ![]() Like UglifyJS there is a tool we can use called CSSNano that will minify CSS. Looking at this file we can see that the content is also not minified. Javascript is not the only file type we can minify, let’s look at CSS next.Ī quick search for styles.css in the network tab filters the results. Pasting in contents of this file gives us a saving of 42.5% on this file, from 19kb to 11kb. To do this we use a tool called UglifyJS.Īll you do is copy and paste the contents of the script into an online minifier. When this happens we still have the option of minifying it ourselves. Sometimes you will come across a javascript file that is custom and does not have a. Let's see if there are any more scripts we can improve this way? This is the same file as the original, except it has had all unnecessary characters removed. To load the minified version of this file you add. So let's take this URL, copy the address and load the file in a new tab. I know that they also offer a minified version of this file. In this example, the JQuery file is not minified as there are comments and it is easy to read. ![]() Using Chrome Developer Tools we can find the file by filtering on the network tab for JQuery. Minifying removes all the unnecessary information like spaces, comments, etc.Ī common mistake I see often is using an un-minified JQuery file. Minifying files such as Javascript, CSS styles and HTML, will make them smaller.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |