mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
15d9a77092
* moved `server/config` to `shared/config` * updated config import paths in server to use shared * updated config import paths in frontend to use shared * updated config import paths in test to use shared * updated config import paths in root to use shared * trigger regression tests * of course the rebase broke tests
28 lines
789 B
JavaScript
28 lines
789 B
JavaScript
const hbs = require('express-hbs');
|
|
const config = require('../../../shared/config');
|
|
const instance = hbs.create();
|
|
|
|
// @TODO think about a config option for this e.g. theme.devmode?
|
|
if (config.get('env') !== 'production') {
|
|
instance.handlebars.logger.level = 0;
|
|
}
|
|
|
|
instance.escapeExpression = instance.handlebars.Utils.escapeExpression;
|
|
|
|
instance.configure = function configure(partialsPath) {
|
|
const hbsOptions = {
|
|
partialsDir: [config.get('paths').helperTemplates],
|
|
onCompile: function onCompile(exhbs, source) {
|
|
return exhbs.handlebars.compile(source, {preventIndent: true});
|
|
}
|
|
};
|
|
|
|
if (partialsPath) {
|
|
hbsOptions.partialsDir.push(partialsPath);
|
|
}
|
|
|
|
return instance.express4(hbsOptions);
|
|
};
|
|
|
|
module.exports = instance;
|