Ghost/core/server/themes/loader.js
Hannah Wolfe b6b299a8f7 Used ghost-ignition.debug, removed debug dep (#8881)
no issue

- Upgraded ghost-ignition
- Use debug from ghost-ignition everywhere in the code base
- Remove debug dependency
- Fixed random typo in Gruntfile.js
2017-08-15 18:29:27 +07:00

31 lines
863 B
JavaScript

var debug = require('ghost-ignition').debug('themes:loader'),
config = require('../config'),
themeList = require('./list'),
read = require('../utils/packages').read,
loadAllThemes,
loadOneTheme;
loadAllThemes = function loadAllThemes() {
return read
.all(config.getContentPath('themes'))
.then(function updateThemeList(themes) {
debug('loading themes', Object.keys(themes));
themeList.init(themes);
});
};
loadOneTheme = function loadOneTheme(themeName) {
return 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
};