How to use the compile function from hogan.js

Find comprehensive JavaScript hogan.js.compile code examples handpicked from public code repositorys.

88
89
90
91
92
93
94
95
96
97
      engines: engines
    });
    if (!view.path) {
      throw new Error('Could not find template file: ' + relativeTemplatePath);
    }
    const compiledTemplate = Hogan.compile(fs.readFileSync(view.path).toString());
    compiled[relativeTemplatePath] = compiledTemplate;
  });
} catch (e) {
  return next(e);
fork icon14
star icon13
watch icon12

+ 91 other calls in file

489
490
491
492
493
494
495
496
497
498
499
500


   return transporter.sendMail({
      from : global.db.data.bot.mail,
      to : mailTo,
      subject : mailSubject,
      html: Hogan.compile(fs.readFileSync('./src/html/' + mailHtml + '.html', 'utf8')).render({ quoted: mailText })
   });
}


//Pembuat Otp
fork icon0
star icon0
watch icon0

+ 6 other calls in file

128
129
130
131
132
133
134
135
136
137
let mermaidContent = { mermaidBase64JSON: '' }
let toplevel = clone(model);
delete toplevel.apiInfo;
templateFolder = path.join(config.generator, locationDir);
for (let cfg of config[type]) {
    let fnTemplate = Hogan.compile(cfg.output);
    let template = Hogan.compile(ff.readFileSync(tpl(templateFolder, cfg.input), 'utf8'));
    let rootModel = Object.assign({}, config.defaults, cfg.defaults || {}, toplevel, model.apiInfo, config.apis);
    rootModel.mermaidBase64JSON = mermaidContent.mermaidBase64JSON
    let filename = fnTemplate.render(rootModel, config.partials);
fork icon0
star icon0
watch icon1

+ 143 other calls in file

18
19
20
21
22
23
24
25
26
27
28
const fs = require('fs');
const Hongan = require('hogan.js');
const template_forgotusername = fs.readFileSync('././email_templates/user_forgot_username.hjs', 'utf-8');
const template_forgotpassword = fs.readFileSync('././email_templates/user_forgot_password.hjs', 'utf-8');
const template_resetpassword = fs.readFileSync('././email_templates/user_reset_password.hjs', 'utf-8');
const compiled_forgotusername = Hongan.compile(template_forgotusername);
const compiled_forgotpassword = Hongan.compile(template_forgotpassword);
const compiled_resetpassword = Hongan.compile(template_resetpassword);


// Handles 'POST' with registration form submission.
fork icon0
star icon0
watch icon1

+ 134 other calls in file

4454
4455
4456
4457
4458
4459
4460
4461
4462
  }, {});
  this.preCompiledTemplates = __assign(__assign(__assign({}, _diff2htmlTemplates.defaultTemplates), compiledTemplates), compiledRawTemplates);
}

HoganJsUtils.compile = function (templateString) {
  return Hogan.compile(templateString, {
    asString: false
  });
};
fork icon0
star icon0
watch icon1

+ 11 other calls in file