mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
bab5764179
- 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
28 lines
885 B
JavaScript
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
|
|
};
|