Best trade in value for iphone x21 comments
Forex broker jobs in dubai
Compressing files can be a very effective way of reducing their size as they are transferred between the server and a user's browser.
Most modern browsers work effectively with compressed files and use lossless compression formats such as Gzip, Deflate or Zlib. In order to compress a file, an encoder is needed to process the file and compress it into the required format. There are a number of different encoders and many of them are very effective at quickly processing and compressing files on-the-fly.
Most of these encoders achieve good file compression ratios, but each of them has their pros and cons. Whilst this may seem like a small improvement, remember every byte saved makes download speeds just that little bit faster! Google Fonts actually uses Zopfli to compress all of the fonts that they serve.
Rather, Zopfli is an improvement to the encoding algorithm for these formats. You must be thinking - this is amazing, when can I start using it? You can start using Zopfli immediately, but while it does come with improved compression ratios, it does unfortunately come at a cost.
You can either download this compiled version that I have created on Github , or download a copy of the original source and compile it for yourself.
Next, install a copy of Grunt in your development directory by typing the following into the console. The command above will save a copy of the Grunt Zopfli plugin to your development directory. Before we begin compressing our files, we need to create a Gruntfile in order to reference the files that we want to process.
My Gruntfile looks a little something like the following:. In the code above, I am pointing to the original version of my file and creating a new compressed copy of the file called processed. As is the convention with Gzipped files, the extension should end in a ". Next, I am adding a reference to the zopfli. All that is left to do is run the task against our file. Simply type "grunt" into the console.
You should notice a file called processed. This file is processed and ready to roll. GZip is a standard format supported by most modern servers and browsers, and in order to use your newly processed file you may need to configure your server accordingly. The great thing about this plugin is that once you have automated your build process, any changes will be picked up and compressed accordingly. For further details, there is a great video interview with the Google Web Fonts team about how they used Zopfli to improve their compression ratios.
I also recommend having a look at the Google Developers blog for more information. Finally, if you are having trouble getting up and running, I have created a repo on Github with the full source code for this example.
Menu Home About Subscribe. My Gruntfile looks a little something like the following: