See our latest episode of Six Degrees of Jigsaw.
Compressing your website during development and after launch is crucial.
Note: I develop custom WordPress themes from scratch, so when applicable, I’ll refer to ways to implement these techniques using WordPress.
This is increasingly important now that responsive design for mobile devices is the de facto standard. You can no longer simply use CSS media queries to reformat the layout to be more mobile-friendly and call it “done”. If we’re truly going for a “mobile first” experience, we need to make these websites lean and mean to give end users the best experience possible. Depending on your audience, the download size of your website could actually be costing your visitor money in the form of paid bandwidth. Check out this tool, whatdoesmysitecost.com, which illustrates the financial cost to access a website on a mobile network around the globe. I don’t think I’ll be moving to Vanuatu anytime soon.
For starters, try using Google Pagespeed Insights to evaluate your site performance while you develop to see if there’s things you could be doing differently. Here are a few ways I recommend to improve the performance of your website:
I can’t stress this enough. If you’re installing a commercial theme, it’s likely riddled with code and extra features that your site doesn’t require. The codebase is also likely overly complicated, so modification for performance boosts, or otherwise, becomes more difficult than it has to be. I highly recommend building WordPress themes from scratch. You should develop only the features you need, keeping the download heft to a minimum. The same goes for CSS Frameworks; sure you could use Foundation (50k, minified) or Bootstrap (123k, minified) to kickstart a project. I’ve been using the percentage-based Skeleton grid framework (11k, not minified), but not necessarily for its features, but for its lack of features. In this instance, less IS more.
I prefer to abstract my CSS stylesheets into the particular purposes each plays. I separate all of my color, layout, typography, browser resets and other utilities into their own stylesheets – for organizational purposes. This makes finding and editing particular website features easy. I used to call each of these stylesheets separately in my projects, creating more http requests than necessary and slowing down the website in the process. I once saw Brad Frost speak at An Event Apart Chicago 2014 and he implored the group to use SASS to combine files to boost site performance. That’s when I decided to make the leap into a SASS workflow. At first, it was simply to aggregate all my stylesheets into one so I could get a performance boost, but as I became more comfortable with the syntax I started using SASS mixins and variable shorthands to speed up my process.
Here’s an example of how I organize and import separate stylesheets at the end of my style.scss file, which results in a single style.css file ready for enqueuing into my WordPress theme.
/* @group #SASS Import ================================================== */ @import 'bower_components/font-awesome/scss/font-awesome.scss'; @import 'sass/utilities/normalize'; @import 'sass/utilities/skeleton'; @import 'sass/wordpress-defaults'; @import 'sass/layout'; @import 'sass/typography'; @import 'sass/color'; @import 'sass/plugins/offcanvasmenu-skin'; /* @end */
You gnarly programmer-types might use SASS via command line, but as I see myself a designer first, and developer second, I prefer to use the CodeKit IDE to run my SASS processes. It’s got a boatload of other helpful tools you might want to poke around. If you’re interested in using this type of workflow, here’s a primer on SASS and the full documentation.
Sure, Photoshop is a great design tool – I’m not knocking it, whatsoever. It’s got an excellent interface for exporting graphics in a myriad of formats. But, we can do better. We can get those file sizes smaller. Try testing Google Pagespeed Insights on a website you just built. Google will call you out if you’re serving up images that could be smaller in file size. Don’t fret, because there are a few ways to address this.


Okay, so you’ve launched your new WordPress website… now what? Your job’s not done. You’ve still got to cache and optimize. I don’t normally recommend plug-ins for core features of websites, but in the case of caching, compression and optimization, I tend to lean on the WordPress plugin repository. Here are some I’ve used over the years.
AddOutputFilterByType DEFLATE "application/atom+xml" "application/javascript" "application/json" "application/ld+json" "application/manifest+json" "application/rdf+xml" "application/rss+xml" "application/schema+json" "application/vnd.geo+json" "application/vnd.ms-fontobject" "application/x-font-ttf" "application/x-javascript" "application/x-web-app-manifest+json" "application/xhtml+xml" "application/xml" "font/eot" "font/opentype" "image/bmp" "image/svg+xml" "image/vnd.microsoft.icon" "image/x-icon" "text/cache-manifest" "text/css" "text/html" "text/javascript" "text/plain" "text/vcard" "text/vnd.rim.location.xloc" "text/vtt" "text/x-component" "text/x-cross-domain-policy" "text/xml"
ExpiresActive on ExpiresDefault "access plus 1 month" # CSS ExpiresByType text/css "access plus 1 year" # Data interchange ExpiresByType application/atom+xml "access plus 1 hour" ExpiresByType application/rdf+xml "access plus 1 hour" ExpiresByType application/rss+xml "access plus 1 hour" ExpiresByType application/json "access plus 0 seconds" ExpiresByType application/ld+json "access plus 0 seconds" ExpiresByType application/schema+json "access plus 0 seconds" ExpiresByType application/vnd.geo+json "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType text/xml "access plus 0 seconds" # Favicon (cannot be renamed!) and cursor images ExpiresByType image/vnd.microsoft.icon "access plus 1 week" ExpiresByType image/x-icon "access plus 1 week" # HTML ExpiresByType text/html "access plus 0 seconds" # JavaScript ExpiresByType application/javascript "access plus 1 year" ExpiresByType application/x-javascript "access plus 1 year" ExpiresByType text/javascript "access plus 1 year" # Manifest files ExpiresByType application/manifest+json "access plus 1 week" ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" ExpiresByType text/cache-manifest "access plus 0 seconds" # Media files ExpiresByType audio/ogg "access plus 1 month" ExpiresByType image/bmp "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType image/webp "access plus 1 month" ExpiresByType video/mp4 "access plus 1 month" ExpiresByType video/ogg "access plus 1 month" ExpiresByType video/webm "access plus 1 month" # Web fonts # Embedded OpenType (EOT) ExpiresByType application/vnd.ms-fontobject "access plus 1 month" ExpiresByType font/eot "access plus 1 month" # OpenType ExpiresByType font/opentype "access plus 1 month" # TrueType ExpiresByType application/x-font-ttf "access plus 1 month" # Web Open Font Format (WOFF) 1.0 ExpiresByType application/font-woff "access plus 1 month" ExpiresByType application/x-font-woff "access plus 1 month" ExpiresByType font/woff "access plus 1 month" # Web Open Font Format (WOFF) 2.0 ExpiresByType application/font-woff2 "access plus 1 month" # Other ExpiresByType text/x-cross-domain-policy "access plus 1 week"
Don’t stop optimizing. You can always do more. Here’s some further reading.