Monday, 29 October 2012

Introducing cv.js

A while ago I was reading a post on Lifehacker about a PHP based CV maker script which separates the content from the layout of the CV. Although PHP works well enough for this, I thought I could build something a little more configurable in Javascript with a little Markdown thrown in. So I created cv.js.

Basically the whole user config comes from one JSON file with optional Markdown files for some sections if they get a little too long or more complex formatting is needed, e.g.

  "personal": {
    "name": "John Smith",
    "phone": "(+44) 012 3456 789",
    "email": "",
    "location": "Delight, UK"
  "intro": { "file": "" },

So the format is really simple, and the "intro" section is just loaded from the "" file in the same directory.

This is then loaded into a handlebars template, e.g.

{{#if intro}}
  <section class="intro">
    {{markdown intro}}

I have only created one "basic" template so far, but it is responsive to work on both desktop and mobile devices, along with having a slightly modified print template. It is simple, but it works quite nicely.

From this it generates the static HTML file which can then be uploaded to any web server (or DropBox) and passed around.

Each template lives in its own subdirectory, so it can have external assets such as images and CSS which will be copied over to the output directory along with the static HTML.

Also included is a local testing server so it can be easily tested locally without continually rebuilding it manually.

Go and see a demo or the source on GitHub.