Initial commit

This commit is contained in:
Mattias Erming
2014-07-25 10:48:10 -07:00
commit 3201a33e03
6 changed files with 71 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules/
npm-debug.log

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# Boilerplate theme
This is the boilerplate theme for [JSON Resume](http://jsonresume.org/).

9
index.js Normal file
View File

@@ -0,0 +1,9 @@
var fs = require("fs");
var Handlebars = require("handlebars");
module.exports = {
render: function(resume) {
var template = fs.readFileSync(__dirname + "/resume.template", "utf-8");
return Handlebars.compile(template)(resume);
}
};

19
package.json Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "jsonresume-theme-boilerplate",
"version": "0.0.0",
"description": "Boilerplate theme for JSON Resume",
"author": "Mattias Erming",
"main": "index.js",
"scripts": {
"start": "node serve.js"
},
"repository": {
"type": "git",
"url": "https://github.com/erming/jsonresume-theme-boilerplate"
},
"license": "MIT",
"dependencies": {
"handlebars": "^2.0.0-alpha.4",
"resume-schema": "0.0.11"
}
}

5
resume.template Normal file
View File

@@ -0,0 +1,5 @@
<!doctype html>
<html>
<head></head>
<body>Hello, world.</body>
</html>

33
serve.js Normal file
View File

@@ -0,0 +1,33 @@
//
// Run your theme locally.
//
// This script looks for a local `index.js` file and will then
// try to call `index.render()`.
//
// Requirement:
// `npm install resume-schema`
//
// Usage:
// `node serve.js
//
var http = require("http");
var resume = require("resume-schema").resumeJson;
var theme = require("./index.js");
http.createServer(function(req, res) {
res.writeHead(200, {"Content-Type": "text/html"});
res.end(render());
}).listen(8080);
console.log("Serving theme");
console.log("Preview: http://localhost:8080/");
function render() {
try {
return theme.render(resume);
} catch(e) {
console.log("Error: " + e.message);
return "";
}
}