Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Custom template populator #660

Open
joshmsamuels opened this issue Dec 19, 2021 · 3 comments
Open

[Feature Request] Custom template populator #660

joshmsamuels opened this issue Dec 19, 2021 · 3 comments

Comments

@joshmsamuels
Copy link

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.

@paulbruno
Copy link

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.

@karlmayer
Copy link

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

@SethFalco
Copy link
Member

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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants