You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
thumbsup/src/render.js

28 lines
601 B
JavaScript

var fs = require('fs');
var path = require('path');
var handlebars = require('handlebars');
function compileTemplate(hbsFile) {
var src = fs.readFileSync(path.join(__dirname, '..', 'templates', hbsFile));
return handlebars.compile(src.toString());
}
var galleryTemplate = compileTemplate('gallery.hbs');
exports.gallery = function(list, active) {
var links = list.map(function(item) {
return {
name: item.name,
url: item.name + '.html',
active: (item === active)
};
});
return galleryTemplate({
links: links,
gallery: active
});
};