[Feature Request] Custom template populator
Hi 👋,
I love the idea behind jsonresume, but I do not love the templates that exist today. It would be awesome if the CLI could autofill the json resume into a custom website/resume template, assuming I manually added keys into the the template that the CLI can replace.
I'd like this as well. Just some escape hatch out of using only the named themes on the json-resume.org site, and instead use a custom theme that I'd build.
This is doable with resume-cli. A simple initial approach is to put the 3 files from a template (in my case: index.js, resume.css, & resume.handlebars) into a folder. You could then build using npx resume export --theme ./resume_template/ --resume resume.yaml resume.html
JSON Resume already supports custom themes, you can build it using whatever stack you like.
The Themes page of the website has a section called Want to develop your own?, which I recommend you read.
You can find a template here:
- https://github.com/jsonresume/jsonresume-theme-boilerplate
A minimal theme just exports a render method from a JavaScript file, which outputs HTML.
index.js
/**
* @param {Object} resume
* @returns {string}
*/
function render(resume) {
let html = fs.readFileSync(__dirname + "/template.html", "utf-8");
// populate the template somehow, or use a template engine like Handlebars
return html;
}
module.exports = {
render
};
It's recommended to use a templating engine over just placeholder variables because the schema includes many arrays. Without a templating engine, that'd be very messy to handle.
Later I want to introduce some documentation for theming. I'll be sure to include the most minimal theme possible, like the example above, so it's easier to get started.