mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
bc75fab663
refs:bf0823c9a2
refs:ae86254972
- continuing the work of splitting up the theme service into logical components Themes Service - The serverside theme service now serves just the API and boot - It loads the theme and passes it to the theme-engine via the bridge This achieves the bare minimum goal of removing all the cross requires between server and frontend around themes There is still a lot more to do to achieve an ideal architecture here as laid out inae86254972
28 lines
900 B
JavaScript
28 lines
900 B
JavaScript
const debug = require('ghost-ignition').debug('themes:loader');
|
|
const config = require('../../../shared/config');
|
|
const packageJSON = require('../../lib/fs/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
|
|
};
|