This repository has been archived on 2021-02-16. You can view files and clone it, but cannot push or open issues or pull requests.
Nodezzarella/classes/Template.class.js

46 lines
1.1 KiB
JavaScript

const log = require('color-logs')(true, true, "Template.class.js"),
fs = require("fs"),
hbs = require('handlebars'),
promise = require('promise'),
config = require('../config.json');
hbs.registerHelper('listNav', function(tabs, options) {
var out = '';
for(var x in options['data']['root']){
out = out + "" + options.fn(options['data']['root'][x]) + "";
}
return out;
});
class Template {
/**
*
* @returns {Promise} the navbar in html compiled
*/
/*getNav(){
return new Promise((resolve, reject) => {
fs.readFile('./views/_nav.hbs', 'utf-8', (error, source) => {
const articles = require("../ressources/categories.json");
hbs.registerHelper('nav', (nav) =>{
return nav;
});
var template = hbs.compile(source);
var html = template(articles);
resolve(html);
});
});
}
getToot(){
}*/
}
module.exports = Template;