0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/services/themes/loader.js
Hannah Wolfe bab5764179
Simplified + unified debug naming conventions
- Reduced the number of levels in our debug naming in the frontend
- Unified components like "themes" and "routing" under one name
- Should help to make debug slightly more useful again
2021-07-07 09:57:14 +01:00

28 lines
885 B
JavaScript

const debug = require('@tryghost/debug')('themes');
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
};