2017 Website Update


I'd come across Craft CMS a few times. I was impressed by it's admin interface. It was clean and simple, similar to WordPress. That to me was the main selling point.

But underneath the hood — that's where I fell in love.

WordPress has a lot of legacy code. It's been going for a long time, and has never had an internal rewrite. Craft uses modern PHP, Composer under the hood, and makes development feel like you're coding in this decade. It uses Twig, which is pleasant, although it doesn't match my love for Pug.

I've read some stuff about Pug and Craft, but that's for another day.

Development

It took me an evening to bring my development environment up to scratch. I had issues with running it under Vagrant for Windows, but managed to get them sorted, albeit in a hack-and-slash way. I went on to Docker all the things, which I haven't looked back on, and that works a charm. More on Docker later.

It took me another evening to convert my website over. I had recently become acquainted with Foundation, the CSS framework and it made recreating the site a breeze. The site's front-end is very simple anyway, but I wasn't expecting it to be this easy.

It took me a bit of time to get used to how CSS frameworks work. I didn't and still don't like the idea of including style coupling to my HTML, but it's unavoidable. Before, I was using container divs to separate my columns and rows, and now I'm just more explicit about them. This includes responsive instructions.

There's not much more to say about the development process. It was very simple and rewarding.

Migration

I used a tool called Instablog for Craft and it did the job of handling WordPress exports. It took a bit of fiddling to get it right, and it was a bit hostile in places, but I go there. Not much more to say about the tool.

Deploying was fun. I won't embarrass myself by saying which version of PHP I was running in production, but it was old. I'm now on PHP 7.1. I just bit the bullet and went for it. No problems at all changing over.

Craft has some issues with recent versions of MySQL, but these are resolved fairly swiftly by changing some settings. Sorry to not be specific, but Googling the error messages and clicking on the first Stack Overflow post was all I did!

Differences

There are pros and cons. WordPress handles typography brilliantly, and I've yet to see this implemented in Craft. I guess there's something out there that would manage this for me. Issues like commas and quotes not rendering as best they could be, WordPress handles automatically. No such luck in Craft

It feels quicker. I don't know if it is, but Craft's has inbuilt caching, so that might have something to do with it.

Other than that there's not much else to report. It's nice being able to use OO style code to write templates versus the procedural way WordPress handles everything. Not having to write helper functions that just echo out HTML is nice. Twig is a dream for this kind of thing.

Code

I've put my current progress on GitHub. There's still a lot more to do. In my WordPress theme I had separated out the SASS so that each file was split into concerns and components. This worked really well, but for this I've just cobbled together everything into one file. There's not a lot to it, but it could be separated. This'll probably happen soon.

I've used a similar Gulp setup to before, which works a charm with live-reloading and compilation of development and production assets.


Other than that there's not much more to say. It's been fun and I eagerly await the arrival of Craft 3 in the coming months.

I'm falling for JavaScript a little bit, and I think my future lies in Node. The newer syntaxes are beautiful. But there's no decent off the shelf CMS that matches the polish at this time. I'd love to see something that just works to a decent standard.

Craft is great, but I can't see myself using it for other projects. The cost barrier is the main problem. I don't charge much for most of my work, so I can't expect people to pay to use it when they know and love WordPress. It's free for personal use though.

It's no Holy Grail, but it's not a million miles off!

Oh, and Docker! I use it a bit at work, but I'd never really gotten into before. It took me minutes to set up and I love it. I've no idea how it works, but I'm pretty sure it's magic.


Anyway, I'm hoping to post more, and not just posts about how my website has been updated. It's a weird feedback loop sometimes, but I just don't have much to say that hasn't already been said. I've got a few mental drafts that I want to discuss. Maybe they'll make it here soon.

Or maybe the next few posts will be about how I built my next website about building websites!