Grav Development Part 1: Getting Started


So I've been messing around with Grav for a few days now and believe I'm at a point I can start talking about where I thought I'd hit a wall but ended up finding a pretty easy workaround that made me feel like a bit of an idiot.

Firstly I should point out that Grav's Documentation is more than enough to get anyone going, the important thing is actually reading it and understanding everything. That's going to be the next challenge now I'm over the initial hurdle of getting themes up and running. Chapter 3 is where I've been hanging out most of the time I've been looking into it (when I haven't been just poking around the Admin Panel getting a feel for it). Having a read of the Twig info is actually helping me get my head around how that actually works, and I'm quite keen to see if I can things working for my new personal website how I want them to with what Twig and it's functions is looking like it's capable of.

First things first though, I had to get a theme up and running. So I followed the instructions on this page to get me started. This was where I hit my first hurdle. I could get DevTools installed through the ACP no problem, but how was I going to access the CLI? I could work it in for CMD Prompt to use PHP. Initially I abandoned the idea and just duplicated the Quark theme and started plugging away modifying stuff to my liking. But the more I thought about it the more I knew I wanted to know the whole process. So I came back to it and looked a bit further into it.

This is where the "ending up feeling like an idiot" comes into play. As I'm using Laragon for my local development environment the program comes preconfigured with a terminal emulator called Cmder, Linux/GNU based commands come at me! How I didn't think of that before was beyond me but now we're cooking with gas! Very important to note that the commands still need to be written with php leading the command, so what the documentation says, but with php in front (prepend? Is it prepend as the opposite of append?) to actually make it work. Like this:


λ php bin/gpm install devtools

You'll see in my screengrab below that I had a bit of trial and error before I figured that out. Then I went through the steps described in the documentation to create the new theme:

Test Theme Creation

Everything has come up roses, the new theme works nicely so now I can move on to the HTML and CSS and working out how Twig works with it. Fun times ahead!