Ghost/core/server/services/themes/loader.js
Sam Lord 35e51e364b Switch to @tryghost/debug, remove ghost-ignition
no issue
The only pieces of Ghost-Ignition used in Ghost were debug and
logging. Both of these modules have been superceded by the Framework
monorepo, and all usages of Ignition have now been removed, replaced
with @tryghost/debug and @tryghost/logging.
2021-06-15 17:24:22 +01:00

29 lines
892 B
JavaScript

const debug = require('@tryghost/debug')('themes:loader');
const config = require('../../../shared/config');
const packageJSON = require('@tryghost/package-json');
const themeList = require('./list');
const loadAllThemes = function loadAllThemes() {
return packageJSON
.readPackages(config.getContentPath('themes'))
.then(function updateThemeList(themes) {
debug('loading themes', Object.keys(themes));
themeList.init(themes);
});
};
const loadOneTheme = function loadOneTheme(themeName) {
return packageJSON
.readPackage(config.getContentPath('themes'), themeName)
.then(function (readThemes) {
debug('loaded one theme', themeName);
return themeList.set(themeName, readThemes[themeName]);
});
};
module.exports = {
loadAllThemes: loadAllThemes,
loadOneTheme: loadOneTheme
};