mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
1a9a10c82b
refs #9178, refs 849e97640f
- i've reconsidered, these modules belong to lib
- prettify package-json module
31 lines
900 B
JavaScript
31 lines
900 B
JavaScript
var debug = require('ghost-ignition').debug('themes:loader'),
|
|
config = require('../../config'),
|
|
packageJSON = require('../../lib/fs/package-json'),
|
|
themeList = require('./list'),
|
|
loadAllThemes,
|
|
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
|
|
};
|