mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
4e69f24964
no issue - we're preparing the `package-json` lib to be extracted out of Ghost into its own package so moving the initialization wrapper outside of the folder makes the process a lot easier
29 lines
897 B
JavaScript
29 lines
897 B
JavaScript
const debug = require('ghost-ignition').debug('themes:loader');
|
|
const config = require('../../../shared/config');
|
|
const packageJSON = require('../../lib/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
|
|
};
|