0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Moved hbs engine into new theme engine service

- This is the beginning of splitting up the theme service into:
   - Storage components used by the API (should be a server service)
   - Theme engine & rendering components used by the frontend (this new engine service)
   - The code to activate a theme which is shared code where the API & frontend need to communicate
- This is needed because currently the frontend theme service is required and used by the API, creating tight coupling.
- In my quest to truly separate the API and frontend, this is one of many battles that needs winning
This commit is contained in:
Hannah Wolfe 2021-04-19 15:09:35 +01:00
parent 08fbcf1d90
commit bf0823c9a2
21 changed files with 21 additions and 21 deletions

View file

@ -1,5 +1,5 @@
const config = require('../../shared/config');
const escapeExpression = require('../services/themes/engine').escapeExpression;
const escapeExpression = require('../services/theme-engine/engine').escapeExpression;
const socialUrls = require('@tryghost/social-urls');
const _ = require('lodash');

View file

@ -1,7 +1,7 @@
// This file defines everything that helpers "require"
// With the exception of modules like lodash, Bluebird
// We can later refactor to enforce this something like we did in apps
const hbs = require('./themes/engine');
const hbs = require('./theme-engine/engine');
const errors = require('@tryghost/errors');
const {i18n} = require('../../server/lib/common');

View file

@ -17,7 +17,7 @@ const _ = require('lodash');
const themeConfig = require('./config');
const themeEngines = require('./engines');
const config = require('../../../shared/config');
const engine = require('./engine');
const engine = require('../theme-engine/engine');
// Current instance of ActiveTheme
let currentActiveTheme;

View file

@ -1,6 +1,6 @@
const Promise = require('bluebird');
const errors = require('@tryghost/errors');
const hbs = require('../engine');
const hbs = require('../../theme-engine/engine');
const config = require('../../../../shared/config');
const logging = require('../../../../shared/logging');

View file

@ -2,7 +2,7 @@
const templates = {};
const _ = require('lodash');
const errors = require('@tryghost/errors');
const hbs = require('../engine');
const hbs = require('../../theme-engine/engine');
const {i18n} = require('../../../../server/lib/common');
// Execute a template helper

View file

@ -1,5 +1,5 @@
const _ = require('lodash');
const hbs = require('./engine');
const hbs = require('../theme-engine/engine');
const urlUtils = require('../../../shared/url-utils');
const config = require('../../../shared/config');
const {i18n} = require('../proxy');

View file

@ -1,6 +1,6 @@
const _ = require('lodash');
const Promise = require('bluebird');
const SafeString = require('../../frontend/services/themes/engine').SafeString;
const SafeString = require('../../frontend/services/theme-engine/engine').SafeString;
const errors = require('@tryghost/errors');
const {i18n} = require('../lib/common');
const logging = require('../../shared/logging');

View file

@ -1,6 +1,6 @@
const should = require('should');
const sinon = require('sinon');
const hbs = require('../../../core/frontend/services/themes/engine');
const hbs = require('../../../core/frontend/services/theme-engine/engine');
const helpers = require('../../../core/frontend/helpers');
const labs = require('../../../core/server/services/labs');
const configUtils = require('../../utils/configUtils');

View file

@ -1,6 +1,6 @@
const should = require('should');
const helpers = require('../../../core/frontend/helpers');
const handlebars = require('../../../core/frontend/services/themes/engine').handlebars;
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
const configUtils = require('../../utils/configUtils');

View file

@ -1,5 +1,5 @@
const should = require('should');
const hbs = require('../../../core/frontend/services/themes/engine');
const hbs = require('../../../core/frontend/services/theme-engine/engine');
const configUtils = require('../../utils/configUtils');
const path = require('path');

View file

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const _ = require('lodash');
const helpers = require('../../../core/frontend/helpers');
const handlebars = require('../../../core/frontend/services/themes/engine').handlebars;
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
describe('{{#foreach}} helper', function () {
let options;

View file

@ -1,6 +1,6 @@
const should = require('should');
const helpers = require('../../../core/frontend/helpers');
const handlebars = require('../../../core/frontend/services/themes/engine').handlebars;
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
const configUtils = require('../../utils/configUtils');

View file

@ -1,6 +1,6 @@
const should = require('should');
const helpers = require('../../../core/frontend/helpers');
const handlebars = require('../../../core/frontend/services/themes/engine').handlebars;
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
const configUtils = require('../../utils/configUtils');

View file

@ -1,9 +1,9 @@
const should = require('should');
const hbs = require('../../../core/frontend/services/themes/engine');
const hbs = require('../../../core/frontend/services/theme-engine/engine');
const configUtils = require('../../utils/configUtils');
const path = require('path');
const helpers = require('../../../core/frontend/helpers');
const handlebars = require('../../../core/frontend/services/themes/engine').handlebars;
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
const runHelper = data => helpers.navigation.call({}, data);
const runHelperThunk = data => () => runHelper(data);

View file

@ -1,5 +1,5 @@
const should = require('should');
const hbs = require('../../../core/frontend/services/themes/engine');
const hbs = require('../../../core/frontend/services/theme-engine/engine');
const configUtils = require('../../utils/configUtils');
const path = require('path');
const helpers = require('../../../core/frontend/helpers');

View file

@ -1,6 +1,6 @@
const should = require('should');
const helpers = require('../../../core/frontend/helpers');
const handlebars = require('../../../core/frontend/services/themes/engine').handlebars;
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
function compile(templateString) {
const template = handlebars.compile(templateString);

View file

@ -1,6 +1,6 @@
const should = require('should');
const helpers = require('../../../core/frontend/helpers');
const handlebars = require('../../../core/frontend/services/themes/engine').handlebars;
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars;
let defaultGlobals;

View file

@ -5,7 +5,7 @@ const config = require('../../../../core/shared/config');
// is only exposed via themes.getActive()
const activeTheme = require('../../../../core/frontend/services/themes/active');
const engine = require('../../../../core/frontend/services/themes/engine');
const engine = require('../../../../core/frontend/services/theme-engine/engine');
describe('Themes', function () {
afterEach(function () {

View file

@ -1,6 +1,6 @@
const should = require('should');
const _ = require('lodash');
const hbs = require('../../../../../core/frontend/services/themes/engine');
const hbs = require('../../../../../core/frontend/services/theme-engine/engine');
// Stuff we are testing
const helpers = require('../../../../../core/frontend/helpers');

View file

@ -1,6 +1,6 @@
const should = require('should');
const sinon = require('sinon');
const hbs = require('../../../../core/frontend/services/themes/engine');
const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const themes = require('../../../../core/frontend/services/themes');
// is only exposed via themes.getActive()
const activeTheme = require('../../../../core/frontend/services/themes/active');