Created
September 1, 2014 08:48
-
-
Save cjroth/59f80f1604e86b57b75e to your computer and use it in GitHub Desktop.
node/express.js - include commonly used view locals in every view for convenience
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var _ = require('underscore'); | |
var moment = require('moment'); | |
var config = require('../config'); | |
var pluralize = require('pluralize'); | |
module.exports = function(app) { | |
if (app.get('env') === 'development') { | |
app.locals.pretty = true; | |
} | |
app.locals.basedir = path.join(__dirname, '../views'); | |
app.locals.config = config; | |
app.locals.env = app.get('env'); | |
app.locals._ = _; | |
app.locals.moment = moment; | |
app.locals.pluralize = pluralize; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment