# all files / keystone/server/ initViewEngine.js

22.22% Statements 2/9
0% Branches 0/6
0% Functions 0/1
22.22% Lines 2/9

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    181×

    1×

     var path = require('path');

    module.exports = function initViewEngine (keystone, app) {
    	// Allow usage of custom view engines
    	if (keystone.get('custom engine')) {
    		app.engine(keystone.get('view engine'), keystone.get('custom engine'));
    	}

    	// Set location of view templates and view engine
    	app.set('views', keystone.getPath('views') || path.sep + 'views');
    	app.set('view engine', keystone.get('view engine'));

    	var customView = keystone.get('view');
    	if (customView) {
    		app.set('view', customView);
    	}
    };