3 var path = require('path');
4 var fs = require('fs-extra');
5 var glob = require('glob');
7 module.exports = function(hbs) {
8 var baseDir = path.resolve(__dirname, '../../');
9 var partialsDir = path.resolve(baseDir, './public/templates/partials/');
10 var partialsGlob = path.join(partialsDir, '**/*.hbs');
12 var files = glob.sync(partialsGlob);
13 return files.map(function(file) {
14 var partialName = path.relative(partialsDir, file).replace(/\.hbs$/, '');
15 var partialTemplate = fs.readFileSync(file, 'utf8');
16 hbs.registerPartial(partialName, partialTemplate);