mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
15d9a77092
* moved `server/config` to `shared/config` * updated config import paths in server to use shared * updated config import paths in frontend to use shared * updated config import paths in test to use shared * updated config import paths in root to use shared * trigger regression tests * of course the rebase broke tests
31 lines
928 B
JavaScript
31 lines
928 B
JavaScript
const debug = require('ghost-ignition').debug('themes:loader');
|
|
const config = require('../../../shared/config');
|
|
const packageJSON = require('../../../server/lib/fs/package-json');
|
|
const themeList = require('./list');
|
|
let loadAllThemes;
|
|
let loadOneTheme;
|
|
|
|
loadAllThemes = function loadAllThemes() {
|
|
return packageJSON.read
|
|
.all(config.getContentPath('themes'))
|
|
.then(function updateThemeList(themes) {
|
|
debug('loading themes', Object.keys(themes));
|
|
|
|
themeList.init(themes);
|
|
});
|
|
};
|
|
|
|
loadOneTheme = function loadOneTheme(themeName) {
|
|
return packageJSON.read
|
|
.one(config.getContentPath('themes'), themeName)
|
|
.then(function (readThemes) {
|
|
debug('loaded one theme', themeName);
|
|
return themeList.set(themeName, readThemes[themeName]);
|
|
});
|
|
};
|
|
|
|
module.exports = {
|
|
loadAllThemes: loadAllThemes,
|
|
loadOneTheme: loadOneTheme
|
|
};
|