The blog refactoring of 2013

While I was writing the last few posts, the messiness of the blog’s code base started grating. A while back I’d rebuilt the template from scratch so I wouldn’t have pieces of page all over – I hate having elements opening in one file and closing in another – but even so, the structure of the scripts and styles isn’t all that great. Today I started reorganizing stuff so I can bring it up to shape with shiny new toys. And this time, I’ll try to do it in a more organized way; writing about it helps, as I have to get my thoughts in order to do that – and I can’t write text and code at the same time. The pauses will be handy.

The Plan

“Whut’s the plan, Rob?” said one of them.
“OK lads, this is what we’ll do. As soon as we see somethin’, we’ll attack it. Right?”
– Sir Terry Pratchett, “The Wee Free Men”

Right now I have a few ideas and tools I want to experiment with, which will somehow get roped into this project.

On the scripting side, I want to organize all the loose scripts I have running around. Some of them will inevitably added by WordPress plugins – that can’t be helped, but I’d like to keep the internal stuff as tight as possible. Require.js seems to be a good idea – might even be able to modularize some of the external scripts and load them through it.

For my own stuff I want to use Coffeescript as much as possible, so I get in as much practice as I can. The more I use it, the more I’m liking it.

The stylesheets will get redone in Sass, and compiled in Compass. Again, it’s partly because it’s more efficient, and partly because I need the practice.

I also want the page to be a bit more fluid, so it can be read more easily on devices of different size. I’ve had a play around with Bootstrap, and that seems to do nicely, so in it goes.

The final item on this shopping list is really the first one I’m tackling right now. I’d really like to clean up the templates; right now it’s really just php code, but I’d much rather cut it up into templates of some kind. Some digging around here will be needed, but I’ll allocate a time limit of two or three evenings so I don’t get stuck on that, or wander off bored when my attention span catches up with me.

So far, I’ve set up a local Git repository, cobbled together a Node script to sort out the different apps I’ll be using (CoffeeScript compiler, Compass, and later on the Require.js optimizer) and gathered all the dependencies mentioned above. We’ll see how this goes.

update-blog