Varying Vagrant Vagrants, theme development and Dropbox

When my university decided to discontinue the support for personal webpages (i.e. literally pull the plug from the server hosting them), I was left with a dilemma. I had a pretty static HTML page that was hosted there and a rather standard (and largely abandoned) WordPress installation. Because I liked the structure of my HTML page, I decided to create a theme based on it and restart using my WordPress blog. What you read now, is the result of this conversion. Depending on when you read this post, there may still be some rough patches. In this post, I will show how you can develop a theme for WordPress using Varying Vagrant Vagrants and synchornise it using Dropbox.

If you develop anything for WordPress, I can’t recommend enough Varying Vagrant Vagrants (VVV), a Vagrant configuration for WordPress development. I installed it and managed to make it work without major problems on both Linux (Fedora 30) and Windows 10.

Getting the program running

In order to function and to avoid manually updating the hosts file (not something that you want to do on regular basis), VVV needs vagrant-hostupdater. In Fedora 30, I could not install it because Fedora 30 distributes vagrant2.2.4, which seems to have a problem with vagrant-hostupdater. The solution was to download and manually install vagrant2.2.5, the Centos RPM file. After that everything worked fine.

In Windows 10, I also had problems related to the hosts file. Because I wasn’t running vagrant as administrator, VVV did not have the permissions to update the hosts file and failed to start. Rather than running vagrant as administrator, I decided it’s safer to change the permissions to C:\Windows\System32\drivers\etc\hosts file, so I have write rights. After that, it started without a problem.

VVV and Dropbox

The idea was to create a theme for WordPress which I can customise as I wish. The big problem is that I work on different computers. This means I need to be careful where I keep the latest version of the theme. For this reason, a solution is to store the theme files on Dropbox. However, making then available in VVV proved to be a bit difficult because I did not want to install VVV in dropbox. It would take too much space especially because only a few files change.

What I had to achieve was to ensure that my theme directory is somehow accessible from wp-content/themes. Symbolic links do not work in Windows. The solution proved to be rather simple. All I had to do is to add the following line in Vagrantfile:

Replace <path to template directory> with the path to your Dropbox directory. Inside the directory you should have the files corresponding the theme. As a result of this setting you will have a theme called dinel in your second WordPress installation. Any changes that you make to the theme will be synchronized in all your Dropbox folders and available in your development environment.

So far, I haven’t found any drawback to this approach yet. Let me know if you experienced any problems.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.