[Go Make Things] How to tell if your site is gzipped

Today's newsletter is sponsored by ConfigCat — the feature flag service that helps you release features faster and with less risk. More on them at the end of today's newsletter.

I no longer minify my CSS and JavaScript files.

I've found that gzipping them provides so much of a size reduction and performance improvement that minifying them just isn't worth it.

Today, I want to talk about what gzipping is, how to enable it, and how to check that your site is doing it. Let's dig in!

What is gzipping?

The .gzip format is a compressed file format, a lot like .zip. It reduces the size of your files by, on average, 70 percent. That's huge!

Gzipping a file means sending it down the wire in this compressed format.

The cool thing about gzipped files is that they can be sent compressed in that format from the server, and browsers can unzip them and run them on-the-fly. Even though that involves some work for the browser, because the how much it reduces the size of files, it has a dramatic improvement on web performance.

For example, the entire combined weight of my site's HTML, CSS, and JavaScript is about 44kb. After gzipping, it's just 12.3kb… a single HTTP request!

How to gzip your files

You can enable gzipping on your server.

In your site is hosted on an apache server, you'll need to modify your .htaccess file. The HTML5 Boilerplate used to include this, but removed it a while back. Here's the version I use for my sites.

With ngingx, you'll need to modify your config file.

If you're on a Linux or Unix OS (including macOS), you can also manually gzip files using the command line. I would avoid this if you can, though!

How to check if gzip is enabled on your site

Open the Network tab in your browser's developer tools. Each resource will show two numbers: the actual size (bottom number) and the transferred size (top number).

A screenshot of the Network tab for GoMakeThings.com, showing a gzipped size of 12.3kb and a full size of 44.1kb

If the transferred size is smaller (by a meaningful amount), gzip is enabled.

Make sure to check the Disable cache option before testing, though.

Why not still minify?

Years ago, I wrote about this and noted that I still felt like minification was worth doing.

These days, I would much rather skip it.

The benefits of having no build steps and being able to see the full code as-written far outweigh shaving a literal handful of extra kilobytes off of the transfer size, in my opinion.

Are you looking for a service to support dynamic feature flags? ConfigCat is a cross-platform LaunchDarkly alternative that's easy to learn and quick to set up. With SDKs for 19 platforms — including JavaScript, Python, Ruby, Java, and even Rust — you can toggle features on or off without redeploying.

ConfigCat subscriptions are the same price regardless of your team size. Get 25% off any paid plan with code GO25 or just use ConfigCat's generous free tier. Definitely worth checking out.

Like this? A Go Make Things membership is the best way to support my work and help me create more free content.

Cheers,
Chris

Want to share this with others or read it later? View it in a browser.

Share :

Facebook Twitter Google+ Lintasme

Related Post:

0 Komentar untuk "[Go Make Things] How to tell if your site is gzipped"

Back To Top