My workflow for this blog
This past weekend, I (once again) turned this site back to be my personal blog. I’ve been writing a number of blog posts over at stefanledin.github.io, which was an experiment with Jekyll from the beginning. But now I will try to become more serious with the blogging and have therefore moved it back here.
Now I’m going to tell you about how I made this blog. Consider this post to be a follow up to my previous posts about workflows with a real world example.
WordPress
So let’s get into it. This is not a regular installation of WordPress with all core files lying directly in the root of the server. Instead I added WordPress as a Git submodule and placed it in an own directory called wp/
. A little bit of magic in wp-config.php
allowed me to create a custom wp-content
folder called just content
. There is where the theme, plugins and uploaded images are stored.
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/content' );
The good thing with this approach is that I don’t have to include WordPress itself into my Git repo. When it’s time to do an upgrade, I’ll just checkout the latest version on my local installation first to confirm that everything works. After that I’ll just do the same on the production server.
As an example, this is how I upgraded from 3.9 to 3.9.1:
git fetch --tags
git checkout 3.9.1
Deployment
When the site was ready to be deployed I used WP Migrate DB to export my local database. The plugin allows you to quickly replace the local URL, stefanledin.se
with stefanledin.se
.
For deploying the code to the production server I used DPLOY.
Theme
As I guess that you can tell, I have used Bootstrap for the front-end. I usually prefer Foundation, but I think that Bootstrap looks better out of the box.
Since I like working with Sass it’s the, now official, Sass-powered version of Bootstrap that I’ve used. It’s included into my project as a dependency managed by Bower.
The tool I’ve used for compiling the Sass is Gulp, which I prefer over Grunt these days.
The WordPress theme is based on my Bigfoot starter theme that I’ve recently written. You can also find the whole site over at GitHub in the stefanledin.se repository.