mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Improved theme loading
- In some cases, Ghost exploded when the active theme did not have a partials directory - Added handling for if the active theme was not present - Probably will conflict with #574 I need to fix this.
This commit is contained in:
parent
76c2ff6818
commit
56b7f925da
1 changed files with 14 additions and 3 deletions
|
@ -303,9 +303,20 @@ Ghost.prototype.initTheme = function (app) {
|
|||
express['static'].mime.define({'application/font-woff': ['woff']});
|
||||
|
||||
if (!res.isAdmin) {
|
||||
if (!self.themeDirectories.hasOwnProperty(self.settings().activeTheme)) {
|
||||
// Throw an error if the theme is not available...
|
||||
// TODO: move this to happen on app start
|
||||
errors.logAndThrowError('The currently active theme ' + self.settings().activeTheme + ' is missing.');
|
||||
} else if (self.themeDirectories[self.settings().activeTheme].hasOwnProperty('partials')) {
|
||||
// Check that the theme has a partials directory before trying to use it
|
||||
app.engine('hbs', hbs.express3(
|
||||
{partialsDir: path.join(self.paths().activeTheme, 'partials')}
|
||||
));
|
||||
} else {
|
||||
// No partial dir, so no need to configure it
|
||||
app.engine('hbs', hbs.express3());
|
||||
}
|
||||
|
||||
app.set('views', self.paths().activeTheme);
|
||||
} else {
|
||||
app.engine('hbs', hbs.express3({partialsDir: self.paths().adminViews + 'partials'}));
|
||||
|
|
Loading…
Reference in a new issue