Skip to content

Instantly share code, notes, and snippets.

@mytharcher
Created March 13, 2013 05:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mytharcher/5149597 to your computer and use it in GitHub Desktop.
Save mytharcher/5149597 to your computer and use it in GitHub Desktop.
Partials path config for Hogan(Mustache) in Express.js
app.set('partials', require('./lib/partials'));
var approot = process.env.PWD;
var path = require('path');
var glob = require('glob');
var config = require(approot + '/config');
var partialsPath = path.join(approot, config.path.views, config.path.partials);
var RE = new RegExp('^' + partialsPath + '/|\\.' + config.viewExt + '$', 'g');
glob.sync(partialsPath + '/**/*.' + config.viewExt).forEach(function (file) {
var partPath = file.replace(RE, '');
exports[partPath] = file;
});
@mytharcher
Copy link
Author

This gist was deprecated. Please turn to MustLayout instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment