0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Moved handlebars utils to new theme engine service

refs: bf0823c9a2

- continuing the work of splitting up the theme service into logical components
This commit is contained in:
Hannah Wolfe 2021-04-19 15:41:18 +01:00
parent dd09a4500d
commit ef4e4e8cc0
12 changed files with 10 additions and 7 deletions

View file

@ -1,4 +1,4 @@
const helpers = require('../../services/themes/handlebars/register');
const helpers = require('../../services/theme-engine/handlebars/register');
const routingService = require('../../services/routing');
module.exports.getInstance = function getInstance() {

View file

@ -61,12 +61,12 @@ module.exports = {
},
// The local template thing, should this be merged with the channels one?
templates: require('./themes/handlebars/template'),
templates: require('./theme-engine/handlebars/template'),
// Various utils, needs cleaning up / simplifying
socialUrls: require('@tryghost/social-urls'),
blogIcon: require('../../server/lib/image').blogIcon,
urlService: require('./url'),
urlUtils: require('../../shared/url-utils'),
localUtils: require('./themes/handlebars/utils')
localUtils: require('./theme-engine/handlebars/utils')
};

View file

@ -0,0 +1,3 @@
module.exports = {
loadCoreHelpers: require('./handlebars/helpers').loadCoreHelpers
};

View file

@ -102,7 +102,6 @@ module.exports = {
},
storage: require('./storage'),
middleware: require('./middleware'),
loadCoreHelpers: require('./handlebars/helpers').loadCoreHelpers,
/**
* Load all inactive themes
*/

View file

@ -13,6 +13,7 @@ const urlService = require('../../../frontend/services/url');
const urlUtils = require('../../../shared/url-utils');
const sitemapHandler = require('../../../frontend/services/sitemap/handler');
const appService = require('../../../frontend/services/apps');
const themeEngine = require('../../../frontend/services/theme-engine');
const themeService = require('../../../frontend/services/themes');
const themeMiddleware = themeService.middleware;
const membersMiddleware = require('../../services/members').middleware;
@ -114,7 +115,7 @@ module.exports = function setupSiteApp(options = {}) {
// We do this here, at the top level, because helpers require so much stuff.
// Moving this to being inside themes, where it probably should be requires the proxy to be refactored
// Else we end up with circular dependencies
themeService.loadCoreHelpers();
themeEngine.loadCoreHelpers();
debug('Helpers done');
// Global handling for member session, ensures a member is logged in to the frontend

View file

@ -1,6 +1,6 @@
const should = require('should');
const sinon = require('sinon');
const helpers = require('../../../../core/frontend/services/themes/handlebars/register');
const helpers = require('../../../../core/frontend/services/theme-engine/handlebars/register');
const AppProxy = require('../../../../core/frontend/services/apps/proxy');
const routing = require('../../../../core/frontend/services/routing');

View file

@ -3,7 +3,7 @@ const _ = require('lodash');
const hbs = require('../../../../../core/frontend/services/theme-engine/engine');
// Stuff we are testing
const helpers = require('../../../../../core/frontend/services/themes/handlebars/helpers');
const helpers = require('../../../../../core/frontend/services/theme-engine/handlebars/helpers');
describe('Helpers', function () {
const hbsHelpers = ['each', 'if', 'unless', 'with', 'helperMissing', 'blockHelperMissing', 'log', 'lookup', 'block', 'contentFor'];