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);
	}
};

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') || 'views');
	app.set('view engine', keystone.get('view engine'));

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

Update default views folder so it's relative to the current project, instead of being `/views` at the root of the filesystem.
Update default views folder so it's relative to the current project, instead of being `/views` at the root of the filesystem.
