Drupal Theming: Setup a Local Version!

Drupal IconI’m a firm believer in the idea that a code recompile and quick test (whether that be through automated unit testing, a page refresh, whatever) shouldn’t take more than about 5-10 seconds, or your workflow is going to be lousy with distractions.

I’m working on theming a Drupal site for a non-profit, and I’m struggling to find a way to optimize my theming experience for the final couple of hours of work I’ll probably need to put in. I don’t have a local copy of the database, so I’m working remotely, and like any good developer, I’m in source control–in this case, SVN (bleh). I’ve written about my SVN troubles before, and although they’re fixed now, I still have to commit and purge Drupal’s cache before I can see any changes I make. That’s a 30-60 second lag time right there, for every committable change.

What am I doing in those 30-60 seconds?

Working on my other volunteer sites. Writing a blag post. Writing a story. Writing my novel. Reading blogs. Crocheting. Coding on something super-secret.

Not problem-solving, and not making progress in other areas of this project.

It’s Drupal theming: problems that I run into have to be resolved with tweaks, and often don’t show up until that commit-purge cycle is through. Cache purging is a slow process that brings their web server to a crawl (cuz, you know, it’s Drupal), so I can’t get anywhere working with Blocks and Views while this is going on. Even using the “Rebuild theme registry on every page” setting doesn’t clear the cache fully enough, so I have to clear all the caches.

It’s incredibly frustrating, and I won’t let myself get into a development environment like this again if I can avoid it. My fancy-fast computer is wasted by server-side SVN and Drupal churning.

At least I can make my tweaks faster, I guess.

Lesson to learn: I definitely should have asked for a copy of the database when I first started, especially when SVN became nearly unusable on my desktop. When I had 20 hours of theming to do, it would have been worth it to spend two setting up a local install of Drupal.