mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
1f11bd9012
- The underlying package-json package has had i18n ripped out using the new tpl utility instead - It's also then been refactored to not be a class that needs instantiating - This means it can be required directly and its public interface methods used where needed - This is a much nicer, neater pattern for what is a mature utility library :)
28 lines
897 B
JavaScript
28 lines
897 B
JavaScript
const debug = require('ghost-ignition').debug('themes:loader');
|
|
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
|
|
};
|