diff --git a/core/frontend/services/apps/proxy.js b/core/frontend/services/apps/proxy.js index ca4d6a2e12..099ab78d9d 100644 --- a/core/frontend/services/apps/proxy.js +++ b/core/frontend/services/apps/proxy.js @@ -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() { diff --git a/core/frontend/services/proxy.js b/core/frontend/services/proxy.js index 20244131f2..8f96e3d5fd 100644 --- a/core/frontend/services/proxy.js +++ b/core/frontend/services/proxy.js @@ -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') }; diff --git a/core/frontend/services/themes/handlebars/helpers.js b/core/frontend/services/theme-engine/handlebars/helpers.js similarity index 100% rename from core/frontend/services/themes/handlebars/helpers.js rename to core/frontend/services/theme-engine/handlebars/helpers.js diff --git a/core/frontend/services/themes/handlebars/register.js b/core/frontend/services/theme-engine/handlebars/register.js similarity index 100% rename from core/frontend/services/themes/handlebars/register.js rename to core/frontend/services/theme-engine/handlebars/register.js diff --git a/core/frontend/services/themes/handlebars/template.js b/core/frontend/services/theme-engine/handlebars/template.js similarity index 100% rename from core/frontend/services/themes/handlebars/template.js rename to core/frontend/services/theme-engine/handlebars/template.js diff --git a/core/frontend/services/themes/handlebars/utils.js b/core/frontend/services/theme-engine/handlebars/utils.js similarity index 100% rename from core/frontend/services/themes/handlebars/utils.js rename to core/frontend/services/theme-engine/handlebars/utils.js diff --git a/core/frontend/services/theme-engine/index.js b/core/frontend/services/theme-engine/index.js new file mode 100644 index 0000000000..5a47b18808 --- /dev/null +++ b/core/frontend/services/theme-engine/index.js @@ -0,0 +1,3 @@ +module.exports = { + loadCoreHelpers: require('./handlebars/helpers').loadCoreHelpers +}; diff --git a/core/frontend/services/themes/index.js b/core/frontend/services/themes/index.js index e2ec1a1ed4..5dcac05b1d 100644 --- a/core/frontend/services/themes/index.js +++ b/core/frontend/services/themes/index.js @@ -102,7 +102,6 @@ module.exports = { }, storage: require('./storage'), middleware: require('./middleware'), - loadCoreHelpers: require('./handlebars/helpers').loadCoreHelpers, /** * Load all inactive themes */ diff --git a/core/server/web/site/app.js b/core/server/web/site/app.js index 7992c64fe1..590c578368 100644 --- a/core/server/web/site/app.js +++ b/core/server/web/site/app.js @@ -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 diff --git a/test/unit/services/apps/proxy_spec.js b/test/unit/services/apps/proxy_spec.js index c4aed1f891..26b08fba28 100644 --- a/test/unit/services/apps/proxy_spec.js +++ b/test/unit/services/apps/proxy_spec.js @@ -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'); diff --git a/test/unit/services/themes/handlebars/helpers_spec.js b/test/unit/services/theme-engine/handlebars/helpers_spec.js similarity index 97% rename from test/unit/services/themes/handlebars/helpers_spec.js rename to test/unit/services/theme-engine/handlebars/helpers_spec.js index 7816946002..5160aceecb 100644 --- a/test/unit/services/themes/handlebars/helpers_spec.js +++ b/test/unit/services/theme-engine/handlebars/helpers_spec.js @@ -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']; diff --git a/test/unit/services/themes/handlebars/template_spec.js b/test/unit/services/theme-engine/handlebars/template_spec.js similarity index 100% rename from test/unit/services/themes/handlebars/template_spec.js rename to test/unit/services/theme-engine/handlebars/template_spec.js