Throughout this series, we've been looking at a number of different strategies for keeping our WordPress installations as lean as possible. In doing this, we've talked about a number practical tips to follow regardless of the nature of your project.
In this post, we're going to summarize everything that we've covered in the series in order to provide a single page guide to the tips we've covered, and a reference to the rests of the post in this series.
Trim the Bloat
Throughout this series, one of the key points that has been reiterated is about the responsibility we have regarding our visitors - I'm adamant that we, as developers, need to do a better job.
To that end, I believe that we should spend more time thinking about what we're pushing out on to the Internet for our consumers, as well as the making a concerted effort to optimize our work for both speed and efficiency across the range of devices with which people can view our work.
1. The Path to Bloat
In the first post of the series, we looked at how sites first started and how they have changed over the past couple of decades.
Recall that the average size of a website has increased with 235% over the past three years. Additionally, mobile users are becoming a significantly larger portion of those who visit our site. On top of that, larger your site, the longer it will take to get them to the point of consuming your data.
Try and do more with less.
To summarize the post: Write cleaner code. Be smart about what you use. Invest a little more time when you're writing or building your themes, plugins or site, and you will ultimately require less time in the long run to maintain your work. Perhaps more importantly, your users will require less time to load the site in their browser and ideally have more time to spend on the site.
2: Keeping It Lean
In the second article in the series, we looked at reviewing the various components that make up our sites in an attempt to evaluate if we need everything that we have installed.
- Do you really need that plugin?
- Do you really need that image?
- ...and so on.
Remember: Less is more.
A big part of what we looked at doing came down to making wise decisions regarding what we're going to use to create our site. Simply put, we should spend time planning and thinking about what we're going to do.
Don't just add stuff until you have everything you want and keep your fingers crossed things will work out. Though it may work, that's not a sign of good design or implementation. Use what you need, and only that.
The easiest way to do this will always be to plan out what you want to do in the long run and make sure that each milestone of development falls in line with that plan.
3. Trim It Down
In the third article, we shifted fears and talked specifically about WordPress themes and plugins. Specifically, we took a look at some example HTML that was generated in a theme before I started working on it and after I optimized it.
A lot of websites and themes these days bulk with clearing elements, wrappers, and so on. The actual cost of this seems negligent, hardly worth mentioning, but when you put it all together, it sums up. Not to mention it makes it a bit more complicated to maintain the code especially if the elements are splits across several templates.
The same applies to plugins: Use less, do more. Pick the right plugin for the job and make sure that it does what you need it do and preferably very little more.
4. Optimization Is Key
Optimization is something that is often thought to take place at the end of a project. Many times, we often think of this as minifying our scripts, compressing and merging our stylesheets, and so on. But in reality, optimization is something that we should be doing from the start.
Try and avoid using inline scripts and styles as you really don't need them, and it helps to maintain a separation of concerns which always contributions to higher cohesion and better maintainability.
Wrapping It All Up
This series of articles is in no means complete. From the beginning, it never intended to a be an all-in-one reference for minute enhancements that you can make when working on your projects.
Instead, this series is meant to be a bird's eye view of some of the things that we, as developers, have lost track of over the past few years as web development has gotten increasingly resource heavy.
It's never a bad thing to take a step and take another look at what you've been doing. Hopefully, this guide has proven useful to you; however, if you have additional questions and/or suggestions, don't hesitate to leave a comment!