forked from lorenzodalaqua/jsonresume-theme-autumn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (31 loc) · 766 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fs = require('fs');
const handlebars = require('handlebars');
const wax = require('handlebars-wax');
// Get file and directory names for build
const {
VIEWS_DIR,
PARTIALS_DIR,
TEMPLATE_FILENAME,
CSS_FILENAME,
helpers
} = require('./build-config');
handlebars.registerHelper(helpers);
function render(resume) {
const Handlebars = wax(handlebars);
const css = fs.readFileSync(`${__dirname}/${CSS_FILENAME}`, 'utf-8');
const resumeTemplate = fs.readFileSync(
`${VIEWS_DIR}/${TEMPLATE_FILENAME}`,
'utf-8'
);
Handlebars.partials(`${PARTIALS_DIR}/*.hbs`);
return Handlebars.compile(resumeTemplate)({
css: css,
resume: resume
});
}
module.exports = {
render: render,
pdfRenderOptions: {
mediaType: 'print'
}
};